Skip to contents

A time series list has two sets of names: the names of the list items (as returned by names(tsl)), and the names of the contained zoo objects, as stored in their attribute "name". These names should ideally be the same, for the sake of data consistency. This function extracts either set of names,

Usage

tsl_names_get(tsl = NULL, zoo = TRUE)

Arguments

tsl

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

zoo

(optional, logical) If TRUE, the attributes "name" of the zoo objects are returned. Default: TRUE

Value

list

Examples

#initialize a time series list
tsl <- tsl_initialize(
  x = fagus_dynamics,
  name_column = "name",
  time_column = "time"
)


#get names of zoo objects
tsl_names_get(
  tsl = tsl,
  zoo = TRUE
)
#>   Germany     Spain    Sweden 
#> "Germany"   "Spain"  "Sweden" 

#get list names only
tsl_names_get(
  tsl = tsl,
  zoo = FALSE
  )
#> [1] "Germany" "Spain"   "Sweden" 

#same as
names(tsl)
#> [1] "Germany" "Spain"   "Sweden"