Learn R Programming

tsbox (version 0.3.1)

ts_pick: Pick Series (Experimental)

Description

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

Usage

ts_pick(x, ...)

Value

a ts-boxable time series, with the same class as the input.

Arguments

x

ts-boxable time series, an object of class ts, xts, zoo, 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.

Examples

Run this code
# Interactive use
# \donttest{
ts_plot(ts_pick(
  EuStockMarkets,
  `My Dax` = "DAX",
  `My Smi` = "SMI"
))
head(ts_pick(EuStockMarkets, c(1, 2)))
head(ts_pick(EuStockMarkets, `My Dax` = 'DAX', `My Smi` = 'SMI'))
# }

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

Run the code above in your browser using DataLab