empty | R Documentation |
remove_empty()
remove rows/columns that contain empty strings.
replace_empty()
replaces empty strings.
remove_empty(x, ...)
replace_empty(x, ...)
## S4 method for signature 'ANY'
remove_empty(x, margin = 1, all = FALSE)
## S4 method for signature 'matrix'
replace_empty(x, value)
## S4 method for signature 'data.frame'
replace_empty(x, value)
x |
An R object (should be a |
... |
Currently not used. |
margin |
A length-one |
all |
A |
value |
A possible replacement value. |
N. Frerebeau
Other data cleaning tools:
compact()
,
count()
,
detect()
,
discard()
,
infinite
,
keep()
,
missing
,
remove_constant()
,
zero
## Create a data matrix
X <- matrix(sample(LETTERS, 25, TRUE), nrow = 5, ncol = 5)
## Add empty string
k <- sample(1:25, 3, FALSE)
X[k] <- ""
X
## Remove rows with empty strings
remove_empty(X, margin = 1)
## Replace empty strings
replace_empty(X, value = "XXX")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.