Learn R Programming

tdata (version 0.3.0)

bind.variables: Bind Variables and Create a Data.frame

Description

Use this function to bind variables with the same class of frequency together.

Usage

bind.variables(
  varList,
  interpolate = FALSE,
  adjustLeadLags = FALSE,
  numExo = 0,
  horizon = 0
)

Value

A list with the following members:

data

A numeric matrix representing the final data after the requested fixes. It is a matrix with variables in the columns and frequencies as the row names.

info

An integer matrix containing information about the columns of the final data, such as range of data, missing data, lags/leads, etc.

Arguments

varList

A list of variables (i.e., ldtv objects) with similar frequency class.

interpolate

If TRUE, missing observations are interpolated.

adjustLeadLags

If TRUE, leads and lags are adjusted with respect to the first variable.

numExo

An integer representing the number of exogenous variables.

horizon

An integer representing the required length of out-of-sample data if adjustLeadLags is TRUE and there are exogenous variables. It creates lags of exogenous variables or omits NaNs to make data available.

Examples

Run this code
v1 = variable(c(1,2,3,2,3,4,5),f.monthly(2022,12),"V1")
v2 = variable(c(10,20,30,20,30,40,50),f.monthly(2022,8),"V2")
L = bind.variables(list(v1,v2))

Run the code above in your browser using DataLab