R/lsl_tool.R

Defines functions .vec .vech .ltri .is_est .is_one

.vec <- function(x) {
  x <- as.matrix(as.vector(x))
  return(x)
}

.vech <- function(x) {
  x <- as.matrix(x[lower.tri(x, diag = T)])
  return(x)
}

.ltri <- function(x) {
  x[upper.tri(x == 1)] = 0
  return(x)
}

.is_est <- function(x){
  x <- is.na(x) | x == 1
  return(x)
}

.is_one <- function(x){
  x <- !is.na(x) & x == 1
  return(x)
}

Try the lsl package in your browser

Any scripts or data that you put into this service are public.

lsl documentation built on May 2, 2019, 11:11 a.m.