Learn R Programming

widals (version 0.6.2)

subsetsites.Hst.ls: Site-Wise Extract Space-Time Covariates

Description

Extract space-time covariates by site

Usage

subsetsites.Hst.ls(Hst.ls, xmask)

Value

Space-time covariates. A list of length \(\tau\), each element a \(c\) x \(p_st\) numeric matrix, where \(c\) is the number of TRUE's in boolean xmask, or length of index xmask.

Arguments

Hst.ls

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

xmask

Which sites to remove from Hst.ls. A boolean vector of length \(n\), or a vector of spacial indices.

Examples

Run this code
	
tau <- 70
n <- 28

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

subsetsites.Hst.ls(Hst.ls, c(1,3,10))


subsetsites.Hst.ls(Hst.ls, c(TRUE, TRUE, rep(FALSE, n-2)))


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

Run the code above in your browser using DataLab