R/activate.selection.variable.R

Defines functions activate.selection.variable

activate.selection.variable <- function(P, s) {
  if (P$fraction) {
    P$num <- activate.selection.variable(P$num, s)
    P$den <- activate.selection.variable(P$den, s)
    return(P)
  }
  if (P$product) {
    for (i in 1:length(P$children)) {
      P$children[[i]] <- activate.selection.variable(P$children[[i]], s)
    }
    return(P)
  }
  pos <- Position(function(x) x == s, P$cond, nomatch = 0)
  if (pos > 0) {
    P$cond <- c(P$cond[-pos], paste0(s, " = 1"))
  }
  return(P)
}

Try the causaleffect package in your browser

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

causaleffect documentation built on July 14, 2022, 5:07 p.m.