ts_pick: Pick Series (Experimental)

Description Usage Arguments Value Examples

View source: R/ts_pick.R

Description

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

Usage

1

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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Interactive use

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))

Example output

sh: 1: cannot create /dev/null: Permission denied
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") : cannot open file '/etc/timezone': Permission denied
Warning: Your system is mis-configured: '/etc/localtime' is not a symlink
sh: 1: cannot create /dev/null: Permission denied
Warning message:
In fun(libname, pkgname) : No TZ information found. Falling back to UTC.
         DAX    SMI
[1,] 1628.75 1678.1
[2,] 1613.63 1688.5
[3,] 1606.51 1678.6
[4,] 1621.04 1684.1
[5,] 1618.16 1686.6
[6,] 1610.61 1671.6
      My Dax My Smi
[1,] 1628.75 1678.1
[2,] 1613.63 1688.5
[3,] 1606.51 1678.6
[4,] 1621.04 1684.1
[5,] 1618.16 1686.6
[6,] 1610.61 1671.6
      My Dax My Smi
[1,] 1628.75 1678.1
[2,] 1613.63 1688.5
[3,] 1606.51 1678.6
[4,] 1621.04 1684.1
[5,] 1618.16 1686.6
[6,] 1610.61 1671.6

tsbox documentation built on April 30, 2020, 1:05 a.m.