mm_filter_dates: Filter unit or daily data by inclusive start & end dates

View source: R/mm_filter_dates.R

mm_filter_datesR Documentation

Filter unit or daily data by inclusive start & end dates

Description

Filter unit or daily data by inclusive start & end dates

Usage

mm_filter_dates(
  data,
  date_start = NA,
  date_end = NA,
  day_start = 4,
  day_end = 28,
  date_format = "%Y-%m-%d"
)

Arguments

data

either instantaneous/unit or daily data, having columns for solar.time or date, respectively, to filter

date_start

Date or a class convertible with as.Date. The first date (inclusive) for which to report DO predictions. If NA, no filtering is done.

date_end

Date or a class convertible with as.Date. The last date (inclusive) for which to report DO predictions. If NA, no filtering is done.

Examples

tm <- as.POSIXct("2017-10-02 00:00:00 UTC")
dt <- as.Date("2017-10-02")
udat <- data.frame(solar.time=tm + as.difftime(1:100, units='hours'), value=1:100)
udat1 <- streamMetabolizer:::mm_filter_dates(udat)
udat2 <- streamMetabolizer:::mm_filter_dates(udat, date_start=dt, date_end=dt)
udat3 <- streamMetabolizer:::mm_filter_dates(udat, date_start=dt, date_end=dt, 
  day_start=12, day_end=14)
c(nrow(udat), nrow(udat1), nrow(udat2), nrow(udat3))
ddat <- data.frame(date=dt + as.difftime(1:100, units='days'), value=1:100)
ddat1 <- streamMetabolizer:::mm_filter_dates(ddat)
ddat2 <- streamMetabolizer:::mm_filter_dates(ddat, date_start=dt+10, date_end=dt+20)
c(nrow(ddat), nrow(ddat1), nrow(ddat2))

USGS-R/streamMetabolizer documentation built on Aug. 15, 2023, 7:50 a.m.