View source: R/relevantValues.R
| RelevantNA | R Documentation |
Given any data x, these functions return
the missing value NA, the empty vector, or the
equivalent of the number 0,
with the same type as x.
RelevantZero(x)
RelevantNA(x)
RelevantEmpty(x)
isRelevantZero(x)
x |
Data of any type. |
In the R system, missing values may have different types. For example, if an entry is missing from a numeric vector, it is a missing numeric value, not a missing logical value, and R distinguishes between these two types of missing values.
The function RelevantNA returns a missing value of the same
type as the input x (as defined by typeof).
Thus, RelevantNA(3.2) returns a missing numeric value
and RelevantNA(TRUE) returns a missing logical value.
RelevantEmpty(x) returns a vector of length zero which has the
same type as x. Thus, RelevantEmpty(TRUE) is equivalent
to logical(0).
RelevantZero(x) returns a single value, of the same type as
x, that is equivalent to the number zero. For example,
RelevantZero(TRUE) returns FALSE.
The function isRelevantZero tests whether x is a single
zero value, by testing whether x is identical to
RelevantZero(x).
RelevantZero and RelevantNA return a single value
of the same type as x.
RelevantEmpty returns a zero-length vector of the same type
as x.
isRelevantZero returns a single logical value.
.
typeof
RelevantZero(42)
RelevantZero(TRUE)
RelevantZero("hello world")
RelevantNA(1:3)
typeof(RelevantNA(1:3))
typeof(RelevantNA("hello world"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.