Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

base-dim

Time Series Columns and Rows


Description

Handling columns and rows of 'timeSeries' objects.

Details

dim Returns the dimension of a 'timeSeries' object
dimnames Returns the dimension names of a 'timeSeries' object
colnames<- Assigns column names to a 'timeSeries' object
rownames<- Assigns row names to a 'timeSeries' object

Value

Returns the dimensions and related numbers of a 'timeSeries' object.

Examples

## Load Swiss Pension Fund Benchmark Data -
   X <- LPP2005REC[1:10, 1:3]
   
## Get Dimension - 
   dim(X)
   
## Get Column and Row Names -
   dimnames(X)
   
## Get Column / Row Names -
   colnames(X)
   rownames(X) 
   
## Try your own DIM - 
   DIM <- function(x) {c(NROW(x), NCOL(x))}
   DIM(X) 
   DIM(X[, 1])

## Try length / LENGTH - 
   length(X)
   length(X[, 1])
   LENGTH <- function(X) NROW(X)
   LENGTH(X)
   
## Columns / Rows - 
   ncol(X); NCOL(X)
   nrow(X); NROW(X)
                
## See also - 
   isUnivariate(X)
   isMultivariate(X)

timeSeries

Financial Time Series Objects (Rmetrics)

v3062.100
GPL (>= 2)
Authors
Diethelm Wuertz [aut] (original code), Tobias Setz [cre], Yohan Chalabi [ctb], Martin Maechler [ctb] (<https://orcid.org/0000-0002-8685-9910>)
Initial release
2020-01-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.