Skip to contents

Transform Time Series List to Data Frame

Usage

tsl_to_df(tsl = NULL)

Arguments

tsl

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

Value

data frame

Examples


tsl <- tsl_simulate(
  n = 3,
  rows = 10,
  time_range = c(
    "2010-01-01",
    "2020-01-01"
  ),
  irregular = FALSE
)

df <- tsl_to_df(
  tsl = tsl
)

names(df)
#> [1] "name" "time" "a"    "b"    "c"    "d"    "e"   
nrow(df)
#> [1] 30
head(df)
#>   name       time         a         b         c         d         e
#> 1    A 2010-01-01 0.6004876 0.2827246 0.1951809 0.2117160 0.7122866
#> 2    A 2011-02-10 0.5164341 0.1992767 0.2661115 0.3372193 0.7467385
#> 3    A 2012-03-22 0.6713781 0.9236098 0.9292182 0.6674751 0.6367205
#> 4    A 2013-05-02 0.5373005 0.4582469 0.6247945 0.5426344 0.7330234
#> 5    A 2014-06-12 0.6936860 0.7194246 0.6950660 0.4854932 0.5054069
#> 6    A 2015-07-22 0.6198993 0.5437065 0.7776212 0.5130066 0.3962538