Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

addWaterYear

add a water year column


Description

Add a column to the dataRetrieval data frame with the water year. WQP queries will return a water year column for the start and end dates of the data.

Usage

addWaterYear(rawData)

Arguments

rawData

the daily- or unit-values datset retrieved from NWISweb. Must have at least one of the following columns to add the new water year columns: 'dateTime', 'Date', 'ActivityStartDate', or 'ActivityEndDate'. The date column(s) can be character, POSIXct, Date. They cannot be numeric.

Value

data.frame with an additional integer column with "WY" appended to the date column name. For WQP, there will be 2 columns: 'ActivityStartDateWY' and 'ActivityEndDateWY'.

Examples

nwisData <- readNWISdv('04085427','00060','2012-01-01','2012-06-30')
nwisData <- addWaterYear(nwisData)

wqpData <- readWQPqw('USGS-01594440','01075', '', '')
wqpData <- addWaterYear(wqpData)

dataRetrieval

Retrieval Functions for USGS and EPA Hydrologic and Water Quality Data

v2.7.10
CC0
Authors
Laura DeCicco [aut, cre] (<https://orcid.org/0000-0002-3915-9487>), Robert Hirsch [aut] (<https://orcid.org/0000-0002-4534-075X>), David Lorenz [aut], Jordan Read [ctb], Jordan Walker [ctb], Lindsay Carr [ctb], David Watkins [aut] (<https://orcid.org/0000-0002-7544-0700>), David Blodgett [ctb], Mike Johnson [aut] (<https://orcid.org/0000-0002-5288-8350>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.