sfn_filter {sapfluxnetr} | R Documentation |
Filter sfn_data by variable/s value
Description
Port of filter
for sfn_data
and
sfn_data_multi
objects
Usage
sfn_filter(sfn_data, ..., solar = FALSE)
Arguments
sfn_data |
|
... |
expressions to pass to the |
solar |
Logical indicating if solar timestamp must used to subset |
Details
'sfn_filter' will remove the rows not matching the logical expression/s
provided. So, it will remove cases and will create TIMESTAMP gaps, so its use
is not recommended except in the case of filtering by TIMESTAMP (i.e. to
set several sites (sfn_data_multi) in the same time frame). For other
scenarios (removing extreme environmental conditions values or strange
sapflow measures patterns) see sfn_mutate
and
sfn_mutate_at
Value
For sfn_data
objects, a filtered sfn_data
or NULL if
no data meet the criteria. For sfn_data_multi
another
sfn_data_multi
with the sites filtered, and an empty
sfn_data_multi
if any sites met the criteria
Examples
library(dplyr)
library(lubridate)
# data
data('ARG_TRE', package = 'sapfluxnetr')
# by timestamp
foo_timestamp <- get_timestamp(ARG_TRE)
foo_timestamp_trimmed <- foo_timestamp[1:100]
sfn_filter(
ARG_TRE,
TIMESTAMP %in% foo_timestamp_trimmed
)
# by wind speed value
ws_threshold <- 25
sfn_filter(
ARG_TRE,
ws <= ws_threshold
)
## multi
data('ARG_MAZ', package = 'sapfluxnetr')
multi_sfn <- sfn_data_multi(ARG_TRE, ARG_MAZ)
# by timestamp
sfn_filter(
multi_sfn,
between(day(TIMESTAMP), 18, 22)
)
# by wind speed value
sfn_filter(
multi_sfn,
ws <= ws_threshold
)