The atlastools function atl_filter_covariates
allows convenient
filtering of a dataset by any number of logical filters.
This function can be used to easily filter timestamps in a range, as well as
combine simple spatial and temporal filters.
It accepts a character vector of R
expressions that each return a
logical vector (i.e., TRUE
or FALSE
).
Each filtering condition is interpreted in the context of the dataset
supplied, and used to filter for rows that satisfy each of the filter
conditions.
Users must make sure that the filtering variables exist in their dataset in
order to avoid errors.
atl_filter_covariates(data, filters = c())
data | A dataframe or similar containing the variables to be filtered. |
---|---|
filters | A character vector of filter expressions. An example might be
|
A dataframe filtered using the filters specified.
Pratik R. Gupte
if (FALSE) { night_data <- atl_filter_covariates( data = dataset, filters = c("!inrange(hour, 6, 18)") ) data_in_area <- atl_filter_covariates( data = dataset, filters = c( "between(time, t_min, t_max)", "between(x, x_min, x_max)" ) ) filtered_data <- atl_filter_covariates( data = data, filters = c( "NBS > 3", "SD < 100", "between(day, 5, 8)" ) ) }