variable: Create a Variable

View source: R/variable.R

variableR Documentation

Create a Variable

Description

Use this function to create a variable, which is a data array with frequencies. It can have a name and other named fields.

Usage

variable(data, startFrequency = NULL, name = NULL, fields = NULL)

Arguments

data

The data of the variable.

startFrequency

The frequency of the first element.

name

The name of the variable.

fields

A list that contains named fields.

Value

An object of class ldtv, which is also a list with the following members:

  • data: Determines the data.

  • name: Determines the name.

  • startFrequency: Determines the startFrequency.

  • fields: Determines the fields.

Examples

data <- c(1,2,3,2,3,4,5)
start_f <- f.monthly(2022,12)
fields <- list(c("key1","value1"), c("key2", "value2"))
v1 = variable(data, start_f, "V1", fields)

tdata documentation built on Nov. 7, 2023, 5:07 p.m.