add_branch_condition {mverse}R Documentation

Add branch conditions to a mverse object.

Description

This method adds one or more branch conditions to an existing mverse object. Branch conditions are used to specify an option in one branch dependent on an option in another branch.

Usage

add_branch_condition(.mverse, ...)

## S3 method for class 'mverse'
add_branch_condition(.mverse, ...)

Arguments

.mverse

a mverse object.

...

branch conditions.

Value

a mverse object.

See Also

Other branch condition functions: branch_condition()

Examples

# Define branches and add them to an \code{mverse} object.
y <- mutate_branch(alldeaths, log(alldeaths + 1))
distribution <- family_branch(poisson, gaussian)
# You can match branching options by providing the options
# the way provide them when defining branches.
match_poisson <- branch_condition(alldeaths, poisson)
mv <- mverse(hurricane) %>%
  add_mutate_branch(y) %>%
  add_family_branch(distribution) %>%
  add_branch_condition(match_poisson)
summary(mv)
# You can also condition to reject a pair of options by
# setting reject = TRUE.
match_log_lin <- branch_condition(log(alldeaths + 1), poisson, reject = TRUE)
mv <- add_branch_condition(mv, match_log_lin)
summary(mv)

[Package mverse version 0.1.0 Index]