R/themeListDepth.R

Defines functions themeListDepth

Documented in themeListDepth

#' @title themeListDepth
#' @description Returns depth of nested list.
#' @param this list
#' @param thisdepth numeric of current depth in recursive call
#' @return numeric
#' @keywords internal
themeListDepth <- function(this, thisdepth=0) {
  if (!is.list(this)) {
    return(thisdepth)
  } else {
    return(max(unlist(lapply(this, themeListDepth, thisdepth = thisdepth + 1))))
  }
}

Try the ggedit package in your browser

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

ggedit documentation built on July 8, 2020, 5:34 p.m.