Description Usage Arguments Value See Also Examples
Create a "uts_matrix"
from wide tabular data (see Wikipedia). For data in this format, each row is a vector of observations (also known as a record) for a specific entity (e.g. person, country) at a specific time point. The record consists of measurements across multiple attributes/fields (e.g. several economic indicators, several blood measurement values).
1 2 3 4 5 6 |
values |
a matrix or data.frame of observation values. |
times |
a |
names |
a character vector. The the matching entity names for the records. By default, the row names of |
fields |
a character vector. The the attribute/field names of the records. By default, the column names of |
An object of class "uts_matrix"
. The time series in row entity_name
and column field_name
contains all observations of such entity for such field.
The number of rows is given by to the number of distinct entity names (parameter names
), while the number of columns is given by the number of attributes/fields, i.e. the number of columns of values
.
uts_matrix_long
, uts_vector_long
, uts_vector_wide
1 2 3 4 5 6 7 8 | values <- matrix(1:8, 4, 2)
rownames(values) <- c("CH", "CH", "FR", "US")
colnames(values) <- c("population", "size")
times <- as.POSIXct("2016-01-01") + days(1:4)
uts_matrix_wide(values, times)
# Same, but manually provide entity names
uts_matrix_wide(values, times, names=c("China", "China", "France", "USA"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.