zoo_applyfix.Proxyzoo: Apply a function to data contained in a...

View source: R/Proxyzoo.R

zoo_applyfix.ProxyzooR Documentation

Apply a function to data contained in a PTBoxProxydata::Proxyzoo (proxydata, agedata or both)

Description

Apply a function to data contained in a PTBoxProxydata::Proxyzoo (proxydata, agedata or both)

Usage

## S3 method for class 'Proxyzoo'
zoo_applyfix(
  x,
  fun,
  case = "nmean",
  colsel = 1,
  seed = 0,
  recycle = "unique",
  ...
)

Arguments

x

'Proxyzoo' object

fun

function to apply on the data (has to expect and return a 'zoo::zoo' object. For other input/output type see 'Proxyzoo_apply' (tb implemeted))

case

one of c('nmean', 'meanm', 'n1', '1m', 'oneone', 'nm'), see Details

colsel

integer, only effective for cases 'm' or 'n'

seed

integer, only effective for case 'oneone', 'NULL' turns off randomization (see Return for 'case = oneone')

recycle

logical, only effective for case 'oneone'

...

named arguments that are passed to fun

Details

Cases for combining proxydata ('n' 'proxy_name's) and agedata ('m' age models):

  • 'nmean': apply fun on a all 'proxy_name's columns combined with 'mean()' across all 'm' age models (dim 2 of 'agedata()')

  • 'meanm': apply fun on a all age models columns combined with 'mean()' across all 'proxy_name' columns (dim 2 of 'proxydata()')

  • 'n': as 'nmean' but for combination with 'colsel' number of the age models (if available)

  • 'm': as 'meanm' but for combination with 'colsel' number of the proxy data column (if available)

  • 'oneone': apply function on one-to-one combinations of 'proxy_name' columns from 'proxydata()' and age models from 'agedata()'. 'seed' can be specified to guarantee reproducibility of combination. 'recycle = priom' recycles age models as long as all 'proxy_name' columns have been matched, 'recycle = prion' recycles 'proxy_name' columns as long as all age models have been matched, 'unique' stops combining as soon as either all 'proxy_name' columns or age models have been sampled without replacement.

  • 'nm': apply function across all possible combinations of 'proxy_name' columns and age model in 'agedata()'

See Value for returns.

Value

Return cases:

  • 'nmean': 'Proxyzoo' with 'proxydata()' as input and univariate 'agedata()' of mean age of age models

  • 'meanm': 'Proxyzoo' with with multivariate (!!) 'proxydata()' as result of combination of mean of 'proxy_name' colunms and age models as in input

  • 'n': as 'nmean' but with 'agedata()' as specified by 'colsel'

  • 'm': 'Proxyzoo' with multivariate (!!) 'proxydata()', recycling of one and the same 'proxy_name' column for all age models

  • 'oneone': depending on 'recycle', either mxm or nxn 'Proxyzoo' with column order corresponding to how 'proxy_name' and age models have been combined in the processing. This is why it is not recommended to use a sequence of 'prion' or 'priom'. Instead initial calls to 'priom' or 'prion' are normally follwed only by further 'unique' calls with 'seed = NULL' (no randomization)

  • 'nm': to be determined, maybe list of 'Proxyzoo's?

See Details for possible combinations.

Note

Outputs do not necessarily maintain the same dimensions as inputs (a) because of the different 'case's and (b) because some zoo methods (e.g. interpolation) result in changed time axes that are propagated into the output 'Proxyzoo'.


paleovar/ptboxproxydata documentation built on June 1, 2022, 1:12 a.m.