Standardise a vector

ts_standardise(
  y,
  na.rm = TRUE,
  keepNAvalues = TRUE,
  type = c("mean.sd", "median.mad")[1],
  adjustN = TRUE
)

Arguments

y

A time series or numeric vector

na.rm

Set the na.rm field

keepNAvalues

If na.rm = TRUE and keepNAvalues = TRUE, any NA values in y will be re-inserted after transformation.

type

Center on the "mean" and divide by sd (default), or center on "median" and divide by mad

adjustN

If TRUE, apply Bessel's correction (divide by N-1) or return the unadjusted SD (divide by N) (default = TRUE)

Value

A standardised vector

Author

Fred Hasselman