Skip to contents

Set Column Names in Time Series Lists

Usage

tsl_colnames_set(tsl = NULL, names = NULL)

Arguments

tsl

(required, list) Time series list. Default: NULL

names

(required, list or character vector):

  • list: with same names as 'tsl', containing a vector of new column names for each time series in 'tsl'.

  • character vector: vector of new column names assigned by position.

Value

time series list

Examples

tsl <- tsl_simulate(
  cols = 3
  )

tsl_colnames_get(
  tsl = tsl
  )
#> $A
#> [1] "a" "b" "c"
#> 
#> $B
#> [1] "a" "b" "c"
#> 

#using a vector
#extra names are ignored
tsl <- tsl_colnames_set(
  tsl = tsl,
  names = c("x", "y", "z", "zz")
)

tsl_colnames_get(
  tsl = tsl
)
#> $A
#> [1] "x" "y" "z"
#> 
#> $B
#> [1] "x" "y" "z"
#> 

#using a list
#extra names are ignored too
tsl <- tsl_colnames_set(
  tsl = tsl,
  names = list(
    A = c("A", "B", "C"),
    B = c("X", "Y", "Z", "ZZ")
  )
)

tsl_colnames_get(
  tsl = tsl
)
#> $A
#> [1] "A" "B" "C"
#> 
#> $B
#> [1] "X" "Y" "Z"
#>