uts_vector_long: Create uts_vector from long tabular data

Description Usage Arguments Value See Also Examples

View source: R/wide_long.R

Description

Create a "uts_vector" from long (also known as narrow) tabular data. Data in this format has three different columns; the observation values, the observation times, and the entity/attribute name (e.g. person, country, economic indicator) of each observation.

Usage

1
uts_vector_long(values, times, names = base::names(values))

Arguments

values

a vector observation values.

times

a POSIXct object. The matching observation times.

names

a character vector. The matching entity/attribute names of the observations. By default, the names of values are used.

Value

An object of class "uts_vector" with length given by to the number of distinct sources.

See Also

uts_vector_wide, uts_matrix_long, uts_matrix_wide

Examples

1
2
3
4
5
6
values <- c(a=5, b=6, a=6, a=7)
times <- as.POSIXct("2016-01-01") + dhours(1:4)
uts_vector_long(values, times)

uts_vector_long(values=1:10, times=as.POSIXct("2016-01-01") + days(1:10),
  names=c("a", "a", "a", "a", "a", "c", "c", "b", "b", "b"))

andreas50/utsMultivariate documentation built on Sept. 27, 2021, 10:33 p.m.