sapply.uts_vector: Apply a Function over a Multivariate Time Series

Description Usage Arguments Examples

View source: R/apply.R

Description

Same as sapply in base R, but further simplify the output to a "uts_vector" or "uts_matrix" if possible.

Usage

1
2
3
4
5
## S3 method for class 'uts_vector'
sapply(X, ...)

## S3 method for class 'uts_matrix'
sapply(X, ...)

Arguments

X

a "uts_vector" or "uts_matrix" object.

...

arguments passed to sapply in base R.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Same results as sapply() in base R
sapply(ex_uts_vector(), length)
sapply(ex_uts_vector(), range)

# Results that are further simplified to a "uts_vector"
sapply(ex_uts_vector(), log)
sapply(ex_uts_vector2(), lag_t, ddays(1))

# Results that are further simplified to a "uts_matrix"
sapply(ex_uts_matrix(), length)
sapply(ex_uts_matrix(), sqrt)

andreas50/utsMultivariate documentation built on Sept. 27, 2021, 10:33 p.m.