convert_blank2NA | R Documentation |
convert_blank2NA
converts a column of with blank ("") to NA
. Be certain to check column data types afterwards,
as dates and factors may be affected. Alternative: use related tidyverse
verbs that can achieve a similar effect in
perhaps a few more steps. To improve the speed of conversion between dates and characters, a default format is provided. For large
data-sets, the data copy can be substantial and modifying the data in-place may be prefereable (uses data.table
package)
convert_blank2NA(data, target = "", skip_dates = FALSE, modify_inplace = FALSE)
data |
Data object. |
target |
Replace all "" by default. Can replace with vector (e.g. |
skip_dates |
Logical; exclude date columns from operation. |
modify_inplace |
Logical; uses data.table formats to reduce copies. |
Dataset with NA instead of blank ("") cells.
blankData <- data.frame(x = c(1, "", 2), y = c("", "Cool Stuff", "More Stuff"))
convert_blank2NA(blankData)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.