RelevantNA {spatstat.utils} | R Documentation |
Missing Value, Zero-length Vector, or Zero Value of the Appropriate Type
Description
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
.
Usage
RelevantZero(x)
RelevantNA(x)
RelevantEmpty(x)
isRelevantZero(x)
Arguments
x |
Data of any type. |
Details
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)
.
Value
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.
Author(s)
Adrian Baddeley Adrian.Baddeley@curtin.edu.au.
See Also
Examples
RelevantZero(42)
RelevantZero(TRUE)
RelevantZero("hello world")
RelevantNA(1:3)
typeof(RelevantNA(1:3))
typeof(RelevantNA("hello world"))