filter_dates: Filter values to specified date range

Description Usage Arguments Details Value

Description

filter_dates filters data to within a specified time frame

Usage

1
2
filter_dates(data, criteria, prior.start = 0, after.end = 0,
  dtcols = c("datetime", "start.datetime", "stop.datetime"))

Arguments

data

A data frame with a date/time column called datetime

criteria

A data frame with start and stop date/time columns called start.datetime and end.datetime

prior.start

An optional numeric indicating number of days to go back prior to the start date/time, default is 0

after.end

An optional numeric indicating number of days after the end date/time to include, default is 0

dtcols

An optional vector of strings with the names of the columns to be used for filtering

Details

This function takes a data frame with a column called datetime and a data frame with columns called start.datetime and end.datetime, and filters the data to only include values within the specified time frame. Optionally, two additional parameters (prior.start and after.end) can be included to add additional time before or after the start or end date and time. Both data frames should include a pie.id column to use for joining.

Value

A data frame


bgulbis/BGTools documentation built on May 12, 2019, 8:21 p.m.