Learn R Programming

stagedtrees (version 2.3.0)

get_stage: Get stage or path

Description

Utility functions to obtain stages from paths and paths from stages.

Usage

get_stage(object, path)

get_path(object, var, stage)

Value

get_stage returns the stage name(s) for given path(s).

get_path returns a data.frame containing the paths corresponding to the given stage(s).

Arguments

object

an object of class sevt.

path

character vector, the path from root or a two dimensional array where each row is a path from root.

var

character, one of the variable in the staged tree.

stage

character vector, the name of the stages for which the paths should be returned.

Examples

Run this code
model <- stages_fbhc(full(PhDArticles))
get_stage(model, c("0", "male"))
paths <- expand.grid(model$tree[2:1])[, 2:1]
get_stage(model, paths)
get_path(model, "Kids", "5")
get_path(model, "Gender", "2")
get_path(model, "Kids", c("5", "6"))

Run the code above in your browser using DataLab