R/misc.R

Defines functions rmNullObs is.NullOb

Documented in is.NullOb rmNullObs

#' A helper function that tests whether an object is either NULL _or_
#' a list of NULLs
#'
#' @keywords internal
is.NullOb <- function(x) is.null(x) | all(sapply(x, is.null))

#' Recursively step down into list, removing all such objects
#'
#' @keywords internal
rmNullObs <- function(x) {
  x <- Filter(Negate(is.NullOb), x)
  lapply(x, function(x) if (is.list(x)) rmNullObs(x) else x)
}
MarkEdmondson1234/youtubeAnalyticsR documentation built on June 14, 2018, 12:12 p.m.