NULL_to_charNA: Converts a NULL to NA_character_; or returns the argument...

View source: R/misc.R

NULL_to_charNAR Documentation

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

Description

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

Usage

NULL_to_charNA(char_or_NULL)

Arguments

char_or_NULL

A string or NULL

Examples

  NULL_to_charNA(NA)   ## NA
  NULL_to_charNA(NULL) ## NA_character_
  NULL_to_charNA("hi") ## "hi"


rmzqc documentation built on May 29, 2024, 12:06 p.m.