View source: R/aggregate_pheno.R
aggregate_pheno | R Documentation |
Aggregate values of time series over phenological time windows.
aggregate_pheno(
data,
pheno,
metrics = c("begin", "end"),
fun = "median",
reshape = TRUE,
skip_fun = TRUE,
include_pheno = FALSE,
...
)
data |
List of fitted time series as generated by function |
pheno |
(optional) Output of |
metrics |
(optional) Two-length character: name of metrics to be used
as beginning and ending dates of the windows. Object |
fun |
(optional) A vector of aggregation function names
(default is |
reshape |
(optional) Logical: should outputs be wide-to-log reshaped?
If TRUE (default), the output is returned in the "long" format (as described)
here below); if FALSE, n columns named as |
skip_fun |
(optional) Logical: return also the aggregation function name
among outputs (default is FALSE)?
This parameter is used only if |
include_pheno |
(optional) Logical: return also the input information
provided in argument |
... |
Additional arguments passed to |
A data table with the following fields:
id
: the time series ID (see s2ts
);
year
: the year (integer);
cycle
: the cycle ID (integer);
fun
: the aggregation function (if skip_fun = TRUE
and fun
is a
1-length argument value, this is skipped);
value
: output aggregated value.
Luigi Ranghetti, PhD (2021) luigi@ranghetti.info
# Load input data
data("ts_filled")
data("dt_cycles")
data("dt_pheno")
# Aggregate time series over detected cycles (computing the median, as default)
dt_aggr_0 <- aggregate_pheno(ts_filled, dt_cycles)
dt_aggr_0
# Aggregate time series over phenological metrics using 95% percentile
dt_aggr <- aggregate_pheno(
ts_filled, dt_pheno,
metrics = c("sos", "eos"),
fun = "quantile", probs = 0.95, na.rm = TRUE
)
dt_aggr
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.