Learn R Programming

widals (version 0.6.2)

rm.cols.Hst.ls: Remove Space-Time Covariates from Model

Description

Remove spacial covariates from space-time covariate list

Usage

rm.cols.Hst.ls(Hst.ls, rm.col.ndx)

Value

An unnamed list of length \(\tau\), each element will be a numeric \(n\) x \(p_st - p_rm\) matrix, where \(p_rm\) is the length of rm.col.ndx.

Arguments

Hst.ls

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

rm.col.ndx

Which columns of Hst.ls to remove. A positive scalar integer.

Examples

Run this code
	
tau <- 21
n <- 7
	
pst <- 5
Hst.ls <- list()
for(i in 1:tau) { Hst.ls[[i]] <- matrix(1:pst, n, pst, byrow=TRUE) }

rm.cols.Hst.ls(Hst.ls, c(1,3))


## The function is currently defined as
function (Hst.ls, rm.col.ndx) 
{
    tau <- length(Hst.ls)
    for (i in 1:tau) {
        Hst.ls[[i]] <- Hst.ls[[i]][, -rm.col.ndx, drop = FALSE]
    }
    return(Hst.ls)
  }

Run the code above in your browser using DataLab