subset.tsdl
returns a subset of the time series data from
the Time Series Data Library. Subsets can be for specific periods,
or specific types of data or both.
# S3 method for tsdl subset(x, cond1, cond2, ...)
x | TSDL data or a subset of TSDL data |
---|---|
cond1, cond2 | Optional conditions specifying subject (type) or frequency of the data. Character variable would be recognised as subject and numeric variable would be recognised as frequency. Positions are interchangeable. |
... | Other arguments specifying conditions for where to search and what to search.
|
An object of class tsdl
consisting of the selected series.
See unique(meta_tsdl$frequency)
for possible values
for cond1
and cond2
denoting frequency.
See unique(meta_tsdl$subject)
for possible values
for cond1
and cond2
denoting subject.
Partial matching used for both conditions.
# Subset by frequency tsdl_quarterly <- subset(tsdl,4) tsdl_quarterly#> Time Series Data Library: 64 time series with frequency 4 #> #> Frequency #> Subject 4 #> Demography 2 #> Finance 5 #> Labour market 4 #> Macro-Economic 33 #> Micro-Economic 1 #> Production 14 #> Sales 3 #> Transport and tourism 1 #> Utilities 1 #> Total 64# Subset by frequency and subject tsdl_daily_industry <- subset(tsdl,12,"Industry") tsdl_daily_industry#> Time Series Data Library: 2 Industry time series with frequency 12 #> #> Frequency #> Subject 12 #> Industry 2# Subset by source tsdl_abs <- subset(tsdl, source = "Australian Bureau of Statistics") tsdl_abs#> Time Series Data Library: 65 time series #> #> Frequency #> Subject 1 4 12 Total #> Agriculture 0 0 1 1 #> Demography 0 2 1 3 #> Finance 0 1 2 3 #> Labour market 0 0 4 4 #> Macro-Economic 1 19 1 21 #> Production 0 13 16 29 #> Sales 0 0 1 1 #> Transport and tourism 0 0 2 2 #> Utilities 0 1 0 1 #> Total 1 36 28 65# Subset by starting year tsdl_1948 <- subset(tsdl, start = 1948) tsdl_1948#> Time Series Data Library: 10 time series #> #> Frequency #> Subject 4 12 Total #> Hydrology 0 1 1 #> Labour market 1 5 6 #> Macro-Economic 3 0 3 #> Total 4 6 10# Subset by description tsdl_nettraffic <- subset(tsdl, description = "Internet traffic") tsdl_nettraffic#> Time Series Data Library: 6 Computing time series with frequency 1 #> #> Frequency #> Subject 1 #> Computing 6