Description Usage Arguments Value Examples
Converts all NA's certain columns of a data.frame to empty values
1 | DFna.to.empty(x, coltypes = "all")
|
x |
A data.frame |
coltypes |
Character vector with the types of columns to affect. Default is "all", which includes logical, integer, double, complex, character, raw, and factor. |
A data.frame with the same dimensions and names as x
. Columns whose types were specified in coltypes will be converted to character (except factors, which stay factor).
1 2 3 4 5 6 7 8 | V1 = c(LETTERS[1:8], NA, NA)
V2 = c(NA, 1:8, NA)
V3 = factor(c(rep(c("A","B"), times = 4),NA, NA))
ex1 = data.frame(V1 = V1, V2 = V2, V3 = V3, stringsAsFactors = F)
DFna.to.empty(ex1)
DFna.to.empty(ex1, coltypes = "character")
DFna.to.empty(ex1, coltypes = c("character", "factor"))
DFna.to.empty(ex1, coltypes = c("character", "integer"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.