Get and set unit names of a 'timeSeries'
timeSeries-slotUnits.Rd
Gets and sets the column names of a "timeSeries"
object. The
column names are also called units or unit names.
Examples
## A Dummy 'timeSeries' Object
tS <- dummyMonthlySeries()
tS
#> GMT
#> TS.1 TS.2
#> 2024-01-01 0.35698708 0.60189755
#> 2024-02-01 0.62747768 0.99874081
#> 2024-03-01 0.74160019 0.37559938
#> 2024-04-01 0.56596682 0.55512663
#> 2024-05-01 0.98078651 0.42944396
#> 2024-06-01 0.57681274 0.57587778
#> 2024-07-01 0.43904205 0.43250740
#> 2024-08-01 0.22859970 0.22484576
#> 2024-09-01 0.08215807 0.08498474
#> 2024-10-01 0.85026492 0.63729826
#> 2024-11-01 0.23466126 0.43101637
#> 2024-12-01 0.98816745 0.07271609
## Get the Units -
getUnits(tS)
#> [1] "TS.1" "TS.2"
## Assign New Units to the Series -
setUnits(tS) <- c("A", "B")
head(tS)
#> GMT
#> A B
#> 2024-01-01 0.3569871 0.6018975
#> 2024-02-01 0.6274777 0.9987408
#> 2024-03-01 0.7416002 0.3755994
#> 2024-04-01 0.5659668 0.5551266
#> 2024-05-01 0.9807865 0.4294440
#> 2024-06-01 0.5768127 0.5758778