getMaxStartEnd: Find maximum start and end dates from Daily dataframe

View source: R/getMaxStartEnd.R

getMaxStartEndR Documentation

Find maximum start and end dates from Daily dataframe

Description

Function to find the longest continuous start and end dates from the Daily dataframe. Primary use case is to find input value to use in a call to HYSEP (from package DVStats). If there are gaps in the data, the function will look for the largest continous gap.

Usage

getMaxStartEnd(localDaily, value = "Flow", date = "Date")

Arguments

localDaily

dataframe returned from dataRetrieval

value

character name of discharge column

date

character name of date column

Value

named list with Start and End values

Examples

site <- "04085427"
sampleDates <- sampleDates
Start_extend <- as.character(as.Date(min(sampleDates$ActivityStartDateGiven, na.rm=TRUE))-60)
End_extend <- as.character(as.Date(max(sampleDates$ActivityStartDateGiven, na.rm=TRUE))+60)
Daily <- dataRetrieval::readNWISdv(site,'00060', Start_extend, End_extend)
Daily <- dataRetrieval::renameNWISColumns(Daily)
startEnd <- getMaxStartEnd(Daily)
Start <- startEnd$Start
End <- startEnd$End

USGS-R/USGSHydroTools documentation built on April 17, 2023, 8:09 p.m.