Skip to contents

Uses stats::prcomp() to compute the Principal Component Analysis of a time series and return the principal components instead of the original columns. Output columns are named "PC1", "PC2" and so on.

Usage

f_pca(x = NULL, ...)

Arguments

x

(required, zoo object) Zoo time series object to transform.

...

(optional, additional arguments) Ignored in this function.

Value

zoo object

Examples

x <- zoo_simulate(cols = 2)

y <- f_pca(
  x = x
)

if(interactive()){
  zoo_plot(x)
  zoo_plot(y)
}