Learn R Programming

mverse (version 0.2.3)

add_branch_condition: 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 mverse add_branch_condition(.mverse, ...)

Value

a mverse object.

Arguments

.mverse

a mverse object.

...

branch conditions.

See Also

Other branch condition functions: branch_condition()

Examples

Run this code
# 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)

Run the code above in your browser using DataLab