Skip to contents

A small helper that turns the NULLs in a list (e.g. missing fields in a parsed JSON/Python response) into NA, returning a simplified vector.

Usage

null2na(x)

Arguments

x

A list, possibly containing NULL elements.

Value

A vector with each NULL replaced by NA, simplified by sapply().

Examples

null2na(list(1, NULL, 3))
#> [1]  1 NA  3