is_mt_or_na: Extends is.na to report TRUE if the object has length zero.

View source: R/assignment_utils.R

is_mt_or_naR Documentation

Extends is.na to report TRUE if the object has length zero.

Description

If I want to check whether an element in a list is missing, sometimes it's NA, but sometimes it is simply a vector of length 0. This checks for both possibilities.

Usage

is_mt_or_na(x)

Arguments

x

A vector of any type, of length 0 or 1

Value

TRUE if the vector has length 0 or is NA

Examples

is_mt_or_na(character(0))
is_mt_or_na(NA_character_)
is_mt_or_na("foo")


jonathan-g/semestr documentation built on Jan. 23, 2025, 3:10 p.m.