R/dummy_assign.R

Defines functions dummy_assign

dummy_assign <- function(dummy) {
  terms <- attr(dummy$terms, "term.labels")
  group <- list()
  j     <- 0
  for(k in terms) {
    if(k %in% dummy$facVars) {
      group[[k]] <- rep(j, length(dummy$lvls[[k]]))
    } else {
      group[[k]] <- j
    }
    j <- j + 1
  }
  return(do.call(c, group))
}

Try the SoftBart package in your browser

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

SoftBart documentation built on June 8, 2025, 9:40 p.m.