cl_levels: Get the hierarchical level for each code in a code list

View source: R/cl_levels.R

cl_levelsR Documentation

Get the hierarchical level for each code in a code list

Description

Get the hierarchical level for each code in a code list

Usage

cl_levels(codelist)

Arguments

codelist

the codelist for which to determine the levels.

Details

Levels are numbered with 0 being the top-most level, which contains code without parent (parent missing). In level 1 are codes that have a parent in level 0. Etc.

When the code list does not have a 'parent' column, all codes are in level 0.

Value

An integer vector with the same length as the number of rows in the code list.

Examples

data(objectcodes)
cl_levels(objectcodes)


codelist documentation built on April 12, 2025, 2:25 a.m.