sanitizeNa | R Documentation |
Standardize empty strings (""
), character NAs ("NA"
), and NULL
values
inside a character vector to NA_character_
. Other atomic
data types are
returned unmodified.
sanitizeNa(object, ...)
## S4 method for signature 'DFrame'
sanitizeNa(object)
## S4 method for signature 'atomic'
sanitizeNa(object)
## S4 method for signature 'character'
sanitizeNa(object)
## S4 method for signature 'data.frame'
sanitizeNa(object)
## S4 method for signature 'factor'
sanitizeNa(object)
object |
Object. |
... |
Additional arguments. |
Modified object.
Sanitized to contain proper NA
values.
Updated 2023-09-20.
## character ====
from <- as.character(c(1L, "x", "", "NA", "NULL"))
print(from)
to <- sanitizeNa(from)
print(to)
## DFrame ====
from <- S4Vectors::DataFrame(
"a" = c("foo", ""),
"b" = c(NA, "bar"),
row.names = c("c", "d")
)
print(from)
to <- sanitizeNa(from)
print(to)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.