R/get_leaf_codes.R

Defines functions get_leaf_codes

get_leaf_codes <- function(x,
                           inductiveCodingHierarchyMarker) {

  if (is.list(x)) {
    ### If it's a list, it has to be a list of vectors; so
    ### we call ourselves for every vector in the list
    return(lapply(x,
                  get_leaf_codes,
                  inductiveCodingHierarchyMarker=inductiveCodingHierarchyMarker));
  } else {
    ### If it's just a vector, simply lapply over it
    return(unlist(lapply(x,
                         get_leaf_code,
                         inductiveCodingHierarchyMarker=inductiveCodingHierarchyMarker),
                  recursive=FALSE));
  }

}

Try the rock package in your browser

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

rock documentation built on Dec. 28, 2022, 1:55 a.m.