Site-Wise Extract Space-Time Covariates

Share:

Description

Extract space-time covariates by site

Usage

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

Arguments

Hst.ls

Space-time covariates. A list of length τ, 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.

Value

Space-time covariates. A list of length τ, 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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
	
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)
  }