diff --git a/R/RequiredCols.R b/R/RequiredCols.R index 0477bd04..80c4482a 100644 --- a/R/RequiredCols.R +++ b/R/RequiredCols.R @@ -366,30 +366,30 @@ TADA_GetTemplate <- function() { #' projectProfile <- TADA_ReadWQPWebServices("https://www.waterqualitydata.us/data/Project/search?statecode=US%3A09&characteristicType=Nutrient&startDateLo=04-01-2023&startDateHi=11-01-2023&mimeType=csv&zip=yes&providers=NWIS&providers=STEWARDS&providers=STORET") #' #' # Join all three profiles using TADA_JoinWQPProfiles -#' TADAProfile <- TADA_JoinWQPProfiles(FullPhysChem = physchemProfile, Sites = stationProfile, +#' TADAProfile <- TADA_JoinWQPProfiles(FullPhysChem = physchemProfile, Sites = stationProfile, #' Projects = projectProfile) #' -#' # Run TADA_CheckRequiredFields, returns error message, +#' # Run TADA_CheckRequiredFields, returns error message, #' # 'The dataframe does not contain the required fields: ActivityStartDateTime' #' TADA_CheckRequiredFields(TADAProfile) #' #' # Add missing col -#' TADAProfile1 <- dataRetrieval:::create_dateTime(df = TADAProfile, -#' date_col = "ActivityStartDate", +#' TADAProfile1 <- dataRetrieval:::create_dateTime(df = TADAProfile, +#' date_col = "ActivityStartDate", #' time_col = "ActivityStartTime.Time", -#' tz_col = "ActivityStartTime.TimeZoneCode", +#' tz_col = "ActivityStartTime.TimeZoneCode", #' tz = "UTC") #' -#' review_TADAProfile1 = TADAProfile1 %>% dplyr::select(c("ActivityStartDate", -#' "ActivityStartTime.Time", -#' "ActivityStartTime.TimeZoneCode", +#' review_TADAProfile1 = TADAProfile1 %>% dplyr::select(c("ActivityStartDate", +#' "ActivityStartTime.Time", +#' "ActivityStartTime.TimeZoneCode", #' "ActivityStartDateTime", #' "ActivityStartTime.TimeZoneCode_offset")) #' #' # re-run TADA_CheckRequiredFields, returns TRUE #' TADA_CheckRequiredFields(TADAProfile1) #' } -#' +#' TADA_CheckRequiredFields <- function(.data) { # remove names with TADA. string from require.cols require.originals <- Filter(function(x) !any(grepl("TADA.", x)), require.cols) diff --git a/man/TADA_CheckRequiredFields.Rd b/man/TADA_CheckRequiredFields.Rd index 9cc9210f..08a08748 100644 --- a/man/TADA_CheckRequiredFields.Rd +++ b/man/TADA_CheckRequiredFields.Rd @@ -30,23 +30,23 @@ physchemProfile <- TADA_ReadWQPWebServices("https://www.waterqualitydata.us/data projectProfile <- TADA_ReadWQPWebServices("https://www.waterqualitydata.us/data/Project/search?statecode=US\%3A09&characteristicType=Nutrient&startDateLo=04-01-2023&startDateHi=11-01-2023&mimeType=csv&zip=yes&providers=NWIS&providers=STEWARDS&providers=STORET") # Join all three profiles using TADA_JoinWQPProfiles -TADAProfile <- TADA_JoinWQPProfiles(FullPhysChem = physchemProfile, Sites = stationProfile, +TADAProfile <- TADA_JoinWQPProfiles(FullPhysChem = physchemProfile, Sites = stationProfile, Projects = projectProfile) -# Run TADA_CheckRequiredFields, returns error message, +# Run TADA_CheckRequiredFields, returns error message, # 'The dataframe does not contain the required fields: ActivityStartDateTime' TADA_CheckRequiredFields(TADAProfile) # Add missing col -TADAProfile1 <- dataRetrieval:::create_dateTime(df = TADAProfile, - date_col = "ActivityStartDate", +TADAProfile1 <- dataRetrieval:::create_dateTime(df = TADAProfile, + date_col = "ActivityStartDate", time_col = "ActivityStartTime.Time", - tz_col = "ActivityStartTime.TimeZoneCode", + tz_col = "ActivityStartTime.TimeZoneCode", tz = "UTC") -review_TADAProfile1 = TADAProfile1 \%>\% dplyr::select(c("ActivityStartDate", - "ActivityStartTime.Time", - "ActivityStartTime.TimeZoneCode", +review_TADAProfile1 = TADAProfile1 \%>\% dplyr::select(c("ActivityStartDate", + "ActivityStartTime.Time", + "ActivityStartTime.TimeZoneCode", "ActivityStartDateTime", "ActivityStartTime.TimeZoneCode_offset"))