ch_date_subset {CSHShydRology}R Documentation

Subsets dates by string

Description

Subsets a data frame by an specified date range, provided as a string by the prd argument. This function is meant to emulate the subsetting capability of the xts package.

Usage

ch_date_subset(df, prd)

Arguments

df

data frame of time series data; includes a variable called Date

prd

date range as string formatted as YYYY-MM-DD/YYYY-MM-DD

Value

df

subsetted data frame

Author(s)

Robert Chlumsky

Examples

{
dd <- seq.Date(as.Date("2010-10-01"), as.Date("2013-09-30"), by = 1)
x <- rnorm(length(dd))
y <- abs(rnorm(length(dd)))*2
df <- data.frame("Date" = dd,x,y)
prd <- "2011-10-01/2012-09-30"
summary(ch_date_subset(df,prd))}


[Package CSHShydRology version 1.4.0 Index]