uts_matrix: Unevenly-spaced Time Series Matrix In andreas50/utsMultivariate: Multivariate Unevenly Spaced Time Series

Description

Create a matrix of unevenly spaced time series (`"uts_matrix"`).

`is.uts_matrix` returns `TRUE` if its argument is a `"uts_matrix"` object.

Usage

 ```1 2 3 4``` ```uts_matrix(data = uts(), nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL) is.uts_matrix(x) ```

Arguments

 `data` a `uts`, or a `uts_vector` containing at least one time series. `nrow` the desired number of rows. `ncol` the desired number of columns. `byrow` logical. If `FALSE` (the default) the matrix is filled by columns, otherwise the matrix is filled by rows. `dimnames` a `dimnames` attribute for the matrix: `NULL` or a `list` of length 2 giving the row and column names respectively. `x` an R object.

Details

If there are too few elements in data to fill the matrix, then the elements in data are recycled. However, compared to `matrix` in base R, this function makes fewer guesses about how to coerce and recycle the data, and instead throws an error.

Class `"uts_matrix"` inherits from class `"uts_vector"`. Hence, a `"uts_matrix"` supports all of the methods of a `"uts_vector"`, such as `first`, `last`, `start`, `end`, etc., even though no such methods exist specifically for a `"uts_matrix"`.

Value

An object of class `"uts_matrix"`.

Note

An abstract class `"uts_virtual"` exists from which `"uts"`, `"uts_vector"`, and `"uts_matrix"` inherit: it is used to allow operations such as subtraction to mix the classes.

Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20``` ```# Create using a single "uts" with recycling uts_matrix(ex_uts(), 2, 3) # Create using "uts_vector" with recycling uts_matrix(ex_uts_vector(), 2, 3) uts_matrix(ex_uts_vector(), 2, 2, byrow=TRUE) uts_matrix(ex_uts_vector(), ncol=2) # Empty "uts_matrix" uts_matrix(nrow=2, ncol=3, dimnames=list(c("a", "b"), c("X", "Y", "Z"))) # One of the dimensions is of length zero uts_matrix(nrow=0, ncol=4) uts_matrix(nrow=4, ncol=0) uts_matrix(nrow=0) # The first test returns TRUE, the others return FALSE is.uts_matrix(uts_matrix()) is.uts_matrix(uts_vector()) is.uts_matrix(ex_uts()) ```

andreas50/utsMultivariate documentation built on May 12, 2019, 10:31 p.m.