convert_na_to_blanks {admiral} | R Documentation |
Convert NAs Into Blank Strings
Description
Turn NA
s to blank strings .
Usage
convert_na_to_blanks(x)
## Default S3 method:
convert_na_to_blanks(x)
## S3 method for class 'character'
convert_na_to_blanks(x)
## S3 method for class 'list'
convert_na_to_blanks(x)
## S3 method for class 'data.frame'
convert_na_to_blanks(x)
Arguments
x |
Any R object |
Details
The default methods simply returns its input unchanged. The character
method
turns every instance of NA_character_
or NA
into ""
while preserving all attributes.
When given a data frame as input the function keeps all non-character columns
as is and applies the just described logic to character
all attributes such as labels are preserved.
Value
An object of the same class as the input
See Also
Utilities for Formatting Observations:
convert_blanks_to_na()
,
yn_to_numeric()
Examples
library(tibble)
convert_na_to_blanks(c("a", "b", NA, "d", NA))
df <- tribble(
~USUBJID, ~RFICDTC,
"1001", "2000-01-01",
"1002", "2001-01-01",
"1003", NA
)
print(df)
convert_na_to_blanks(df)
[Package admiral version 1.1.1 Index]