R/dependencies.R

Defines functions dependencies

dependencies <- function(P) {
  dep <- c()
  if (P$fraction) return(union(dependencies(P$num), dependencies(P$den)))
  if (P$sum) {
    for (i in 1:length(P$children)) {
      dep <- union(dep, dependencies(P$children[[i]]))
    }
    return(dep)
  }
  if (P$product) {
    for (i in 1:length(P$children)) {
      dep <- union(dep, dependencies(P$children[[i]]))
    }
    return(dep)
  }
  return(unique(c(P$var, P$cond, P$do)))
}

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.