ts_pick: Pick Series (Experimental)

View source: R/ts_pick.R

ts_pickR Documentation

Pick Series (Experimental)

Description

Pick (and optionally rename) series from multiple time series.

Usage

ts_pick(x, ...)

Arguments

x

ts-boxable time series, an object of class ts, xts, zoo, zooreg, data.frame, data.table, tbl, tbl_ts, tbl_time, tis, irts or timeSeries.

...

character string(s), names of the series to be picked, or integer, with positions. If arguments are named, the series will be renamed.

Value

a ts-boxable object of the same class as x, i.e., an object of class ts, xts, zoo, zooreg, data.frame, data.table, tbl, tbl_ts, tbl_time, tis, irts or timeSeries.

Examples

# Interactive use

ts_plot(ts_pick(
  EuStockMarkets,
  `My Dax` = "DAX",
  `My Smi` = "SMI"
))
ts_pick(EuStockMarkets, c(1, 2))
ts_pick(EuStockMarkets, `My Dax` = "DAX", `My Smi` = "SMI")

# Programming use
to.be.picked.and.renamed <- c(`My Dax` = "DAX", `My Smi` = "SMI")
ts_pick(EuStockMarkets, to.be.picked.and.renamed)



tsbox documentation built on Oct. 23, 2024, 1:07 a.m.