sas_na {tern} | R Documentation |
Convert strings to NA
Description
SAS imports missing data as empty strings or strings with whitespaces only. This helper function can be used to
convert these values to NA
s.
Usage
sas_na(x, empty = TRUE, whitespaces = TRUE)
Arguments
x |
( |
empty |
( |
whitespaces |
( |
Value
x
with ""
and/or whitespace-only values substituted by NA
, depending on the values of
empty
and whitespaces
.
Examples
sas_na(c("1", "", " ", " ", "b"))
sas_na(factor(c("", " ", "b")))
is.na(sas_na(c("1", "", " ", " ", "b")))
[Package tern version 0.9.5 Index]