R/cleanNULL.R

Defines functions cleanNULL

Documented in cleanNULL

#' @title Clean NULL values
#' @description Pass an object and convert all
#' \code{NULL} elements to \code{NA}.
#' @param x An element that may or may not have NULL values.
#' @returns parsed `list` where NULL values are changed to NA
#' @export
cleanNULL <- function(x) { # nolint
  out <- rapply(x,
                function(y) {
                  #print(y)
                  ifelse(is.null(y), NA, y)
                },
                how = "replace")
  return(out)
}

Try the neotoma2 package in your browser

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

neotoma2 documentation built on July 9, 2023, 7:37 p.m.