View source: R/dendro.resample.R
| dendro.resample | R Documentation |
This function changes the temporal resolution of dendrometer and climate
time series. It supports both aggregation to coarser resolutions and
interpolation to finer resolutions. The target resolution can be defined in
minutes, hours, days, weeks, or month-end frequency. Aggregation can be
performed using mean, max, min, sum, or
count (number of non-missing values). When a finer temporal
resolution than the original data is requested, the function can interpolate
the series to the new time step using linear interpolation.
dendro.resample(
df,
by,
value = "mean",
method = c("auto", "aggregate", "interpolate")
)
df |
A dataframe with the first column containing date-time values in
the format |
by |
A character string defining the target temporal resolution. Supported values are:
|
value |
A character string defining the aggregation function.
Supported values are |
method |
A character string defining how resampling should be performed. Options are:
|
A dataframe with resampled data. The first column contains the new time stamps and the remaining columns contain the resampled variables.
library(dendRoAnalyst)
data(nepa17)
# Monthly resampling using maximum values
resample_ME <- dendro.resample(df = gf_nepa17, by = "ME", value = "max")
head(resample_ME, 10)
# Daily resampling using mean values
resample_D <- dendro.resample(df = gf_nepa17, by = "D", value = "mean")
# Count non-missing values per day
resample_count <- dendro.resample(df = gf_nepa17, by = "D", value = "count",
method = "aggregate")
# Interpolate to 30-minute resolution
resample_30M <- dendro.resample(df = gf_nepa17, by = "30M", value = "mean",
method = "auto")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.