subset_dfdates: Subsets a dataframe by dates

Description Usage Arguments Value

Description

The dataframe argument must contain a column with valid dates. The timeframe argument specifies a timeframe xts-style daily. For example, "2011-01-01/2011-12-31" is valid whereas "2011" is not.

Usage

1
2
subset_dfdates(df, timeframe, datecol, keep_NAs = FALSE,
  bounds_rm = c(FALSE, FALSE))

Arguments

df

The dataframe to subset by dates

timeframe

A character string specifying the timeframe as two full dates separated by a slash. For example, "2010-10-01/2010-10-22".

datecol

The column name where the dates are found in the dataframe. Although these may be of class char, they will be converted to class Date before subsetting is applied.

keep_NAs

Logical flag specifying whether to apply complete.cases to the dataframe to eliminate rows with NAs.

bounds_rm

Logical vector of length 2. Specified whether to exclude the rows at the boundary dates specified in timeframe. The first element specifies whether to exclude the start dates while the second element specified whether to exclude the end dates. Default is c(FALSE, FALSE), so both the beginning dates and end dates are included.

Value

Returns a subsetted dataframe containing rows with dates within the timeframe supplied. Also, complete.cases is applied to eliminate rows with NAs if keep_NAs = FALSE (default).


jeanmarcgp/mlStocks documentation built on May 19, 2019, 12:38 a.m.