Learn R Programming

rockchalk (version 1.8.157)

removeNULL: Remove NULL values variables from a list

Description

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

Usage

removeNULL(aList)

Value

Same list with NULL's removed

Arguments

aList

A list

Author

Paul Johnson

Details

This version is NOT recursive

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

Examples

Run this code
## 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)

Run the code above in your browser using DataLab