R/cl_nlevels.R

Defines functions cl_nlevels

Documented in cl_nlevels

#' Get the number of hierarchical levels in a code list
#' 
#' @param codelist the \code{\link{codelist}} for which to determine the number
#' of levels.
#'
#' @return
#' A single integer value (>= 1) with the number of levels.
#' 
#' @export
cl_nlevels <- function(codelist) {
  level <- cl_levels(codelist) 
  as.integer(max(level) + 1)
}

Try the codelist package in your browser

Any scripts or data that you put into this service are public.

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