get_grouping_levels: Get grouping levels

View source: R/helpfunctions.R

get_grouping_levelsR Documentation

Get grouping levels

Description

A helper function that identifies the hierarchy of grouping variables. It checks for each grouping level how many of the other grouping levels it varies within and returns the ranked order of the grouping levels.

Usage

get_grouping_levels(grouping_df)

Arguments

grouping_df

a data.frame of grouping ("id") variables, as obtained from get_groups()

Value

a named integer vector identifying the grouping hierarchy, where "1" is the level of the individual observations and the largest number is the highest grouping level. Crossed levels will have the same number.


JointAI documentation built on Jan. 30, 2026, 5:07 p.m.