sevt_add: Add a variable to a staged event tree

View source: R/9-search-order.R

sevt_addR Documentation

Add a variable to a staged event tree

Description

Return an updated staged event tree with one additional variable at the end of the tree.

Usage

sevt_add(object, var, data, join_unobserved = TRUE)

Arguments

object

an object of class sevt.

var

character, the name of the new variable to be added.

data

either a data.frame or a table containing the data from the variables in object plus var.

join_unobserved

logical, passed to full.

Details

This function update a staged event tree object with an additional variable. The stages structure of the new variable is initialized as in the saturated model.

Value

An object of class sevt representing a staged event tree model with var added as last variable.

Examples

model <- full(Titanic, order = c("Age", "Class"))
print(model)
model <- sevt_add(model, "Survived", Titanic)
print(model)

stagedtrees documentation built on April 29, 2022, 1:06 a.m.