NULL_to_NA function

Converts a NULL to NA; or returns the argument unchanged otherwise

Converts a NULL to NA; or returns the argument unchanged otherwise

This is useful for missing list elements (which returns NULL), but when the missing element in refClass should be NA (and NULL would return an error)

NULL_to_NA(var_or_NULL)

Arguments

  • var_or_NULL: A variable of any kind or NULL

Examples

NULL_to_NA(NA) ## NA NULL_to_NA(NULL) ## NA NULL_to_NA("hi") ## "hi"
  • Maintainer: Chris Bielow
  • License: MIT + file LICENSE
  • Last published: 2025-03-23