clean_timeseries: Remove NAs and aggregate non-unique timesteps in zoo objects

View source: R/Proxytools_helpers.R

clean_timeseriesR Documentation

Remove NAs and aggregate non-unique timesteps in zoo objects

Description

Remove NAs and aggregate non-unique timesteps in zoo objects

Usage

clean_timeseries(
  xin,
  remove_na = TRUE,
  aggregation = TRUE,
  aggregation_fun = mean
)

Arguments

xin

Proxytibble with proxy data in 'zoo::zoo' format, or irregular time series object ('zoo::zoo'), xin can be multivariate

remove_na

Flag if NAs should be removed

aggregation

Flag if non-unique timesteps should be merged

aggregation_fun

Function for merging non-unique timesteps

Value

Proxytibble with proxy data in 'zoo::zoo' format, or irregular time series object ('zoo::zoo')

See Also

aggregate (from 'stats') for merging non-unique timesteps

Examples

# Load Monticchio example data from PTBoxProxydata
library(PTBoxProxydata)
mng <- PTBoxProxydata::ProxyDataManager()
monticchiodata <- PTBoxProxydata::load_set(mng,'monticchio_testset',zoo_format = 'zoo', force_file=TRUE)
# Clean proxy data time series
monticchiodata_cleaned <- clean_timeseries(monticchiodata)
# Clean zoo time series
monticchiozoo_cleaned <- clean_timeseries(monticchiodata$proxy_data[[1]])
# Plot zoo data
plot(monticchiozoo_cleaned)
plot(monticchiodata_cleaned$proxy_data[[1]])


paleovar/ptboxproxytools documentation built on June 9, 2025, 1:40 a.m.