Learn R Programming

CSHShydRology (version 1.4.2)

ch_doys: Days of year and water year

Description

Converts an array of dates into a dataframe with date, year, month, doy, wyear, dowy.

The day of water year is computed from the first of the specified water year month.

Usage

ch_doys(Date, water_yr = 10)

Value

Returns a dataframe with date information:

Date

in Date format

year

numeric calendar year

month

number calendar month

doy

numeric day of year

wyear

numeric water year starting on day 1 of selected month

dwy

numeric day of water year

Arguments

Date

an array of R dates, as produced by as.Date()

water_yr

the month starting the water year, default is 10 (October). If a value of 1 is specified, the 10 will be used.

Author

Paul Whitfield, Kevin Shook

Details

Converts a date array into a data frame with years, wateryears, and days of year and of water year.

Examples

Run this code
dd <- seq.Date(as.Date("2010-01-01"), as.Date("2018-01-01"),by = 1)
output <- ch_doys(dd, water_yr=10)
head(output)

Run the code above in your browser using DataLab