removeNULL function

Remove NULL values variables from a list

Remove NULL values variables from a list

Unlike vectors, lists can hold objects with value NULL. This gets rid of them.

removeNULL(aList)

Arguments

  • aList: A list

Returns

Same list with NULL's removed

Details

This version is NOT recursive

plyr::rbind.fill uses an experimental function that I choose to avoid. This is the "safe" version.

Examples

## Note it is non-recursive, NULL remains in e x <- list(a = rnorm(5), b = NULL, c = rnorm(5), d = NULL, e = list(f = rnorm(2), g = NULL)) x removeNULL(x)

Author(s)

Paul Johnson

  • Maintainer: Paul E. Johnson
  • License: GPL (>= 3.0)
  • Last published: 2022-08-06

Useful links