get_depth: Function to calculate hierarchy depth in lavaan models

View source: R/a_early.R

get_depthR Documentation

Function to calculate hierarchy depth in lavaan models

Description

Function to calculate hierarchy depth in lavaan models

Usage

get_depth(x, model, depth = 0L, max_depth = 20)

Arguments

x

character vector of variables in a lavaan model

model

character, lavaan fit object, or lavaan parameter table

depth

initial depth

max_depth

max depth at which to stop (prevents infinite loops for non-recursive models)

Value

integer

Examples

model <- "X =~ X1 + X2"
get_depth("X", model = model)
get_depth("X1", model = model)

ggdiagram documentation built on Sept. 15, 2025, 1:07 a.m.