R/prelasso_binomial.R

Defines functions prelasso_binomial

prelasso_binomial <- function(y) {
#called by all 4glm functions:
  # glamer_4glm
  # DMRnet4glm
  # SOSnet4glm
  # DMR4glm

  if (!inherits(y, "factor")){
    stop("Error: y should be a factor")
  }
  lev <- levels(factor(y))
  if (length(lev) != 2){
    stop("Error: factor y should have 2 levels")
  }
  y <- ifelse(y == lev[2], 1, 0)
  return(y)
}

Try the DMRnet package in your browser

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

DMRnet documentation built on Aug. 7, 2023, 5:11 p.m.