From 05be4d0b3cd0f6f73c3bd78fea0f9ea688ba6403 Mon Sep 17 00:00:00 2001 From: unknown <ldecicco@usgs.gov> Date: Tue, 9 Sep 2014 10:01:04 -0500 Subject: [PATCH] Unifying argument names. --- R/checkStartEndDate.r | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/R/checkStartEndDate.r b/R/checkStartEndDate.r index 28a1c52e..47540122 100644 --- a/R/checkStartEndDate.r +++ b/R/checkStartEndDate.r @@ -2,36 +2,36 @@ #' #' Checks that the start date is before the end date. If not, it will give the user the opportunity to correct, otherwise will create a warning. #' -#' @param StartDate string -#' @param EndDate string +#' @param startDate string +#' @param endDate string #' @param interactive logical Option for interactive mode. If true, there is user interaction for error handling and data checks. #' @keywords WRTDS flow -#' @return vector where first value is StartDate, second is EndDate +#' @return vector where first value is startDate, second is endDate #' @export #' @examples #' startDate <- '1985-01-01' #' endDate <- '1990-01-01' #' checkStartEndDate(startDate, endDate) -checkStartEndDate <- function(StartDate, EndDate,interactive=TRUE){ +checkStartEndDate <- function(startDate, endDate,interactive=TRUE){ start <- as.Date("1850-01-01") end <- as.Date(Sys.Date()) - if (nzchar(StartDate)) start <- as.Date(StartDate) - if (nzchar(EndDate)) end <- as.Date(EndDate) + if (nzchar(startDate)) start <- as.Date(startDate) + if (nzchar(endDate)) end <- as.Date(endDate) if (start > end) { if (interactive){ - cat ("Start date must be before end date, you entered Start = ", StartDate, " End = ", EndDate, "\n") - cat ("please re-enter StartDate (YYYY-MM-DD) - hit Enter for earliest date as StartDate: \n") - StartDate <- readline() - cat("Please re-enter EndDate (YYYY-MM-DD) - hit Enter for latest date as EndDate: \n") - EndDate <- readline() + cat ("Start date must be before end date, you entered Start = ", startDate, " End = ", endDate, "\n") + cat ("please re-enter startDate (YYYY-MM-DD) - hit Enter for earliest date as startDate: \n") + startDate <- readline() + cat("Please re-enter endDate (YYYY-MM-DD) - hit Enter for latest date as endDate: \n") + endDate <- readline() } else { warningMessage <- "Starting date was not before ending date, dates will be ignored" warning(warningMessage) - StartDate <- as.Date("1851-01-01") - EndDate <- as.Date(Sys.Date()) + startDate <- as.Date("1851-01-01") + endDate <- as.Date(Sys.Date()) } } - return(c(StartDate,EndDate)) + return(c(startDate,endDate)) } -- GitLab