R/nafilter.R

# Returns a boolean array to use as a filter to remove NA's from a
# columnized matrix with NA's on the diagonal (i.e if Y is an n-by-n
# matrix with NA's on the diagonal, we want to remove the NA's from
# c(Y).)
nafilter <- function(n) {
  filter <- rep(TRUE, n^2)
  for (i in 1:n) {
    filter[n * (i - 1) + i] <- FALSE
  }
  return(filter)
}
ianmtaylor1/amen2 documentation built on June 1, 2019, 4:55 a.m.