Learn R Programming

widals (version 0.6.2)

fuse.Hst.ls: Merge Contemporaneous Space-Time Covariates

Description

Fuse together two lists of spacio-temporal covariates

Usage

fuse.Hst.ls(Hst.ls1, Hst.ls2)

Value

An unnamed list of length \(\tau\), each element will be a numeric \(n\) x \((p_1+p_2)\) matrix.

Arguments

Hst.ls1

Space-time covariates. A list of length \(\tau\), each element should be a numeric \(n\) x \(p_1\) matrix.

Hst.ls2

Space-time covariates. A list of length \(\tau\), each element should be a numeric \(n\) x \(p_2\) matrix.

Examples

Run this code

set.seed(9999)

tau <- 5
n <- 7

p1 <- 2
Hst.ls1 <- list()
for(i in 1:tau) { Hst.ls1[[i]] <- matrix(rnorm(n*p1), nrow=n) }

p2 <- 3
Hst.ls2 <- list()
for(i in 1:tau) { Hst.ls2[[i]] <- matrix(rnorm(n*p2), nrow=n) }

fuse.Hst.ls(Hst.ls1, Hst.ls2)


## The function is currently defined as
function (Hst.ls1, Hst.ls2) 
{
    tau <- length(Hst.ls1)
    for (i in 1:tau) {
        Hst.ls1[[i]] <- cbind(Hst.ls1[[i]], Hst.ls2[[i]])
    }
    return(Hst.ls1)
  }

Run the code above in your browser using DataLab