compact {arkhe} | R Documentation |
Remove Empty Rows/Columns
Description
Removes empty rows/columns in an array-like object.
Usage
compact(x, ...)
compact_cols(x, ...)
compact_rows(x, ...)
## S4 method for signature 'ANY'
compact(x, margin = 1, na.rm = FALSE, verbose = getOption("arkhe.verbose"))
## S4 method for signature 'ANY'
compact_cols(x, na.rm = FALSE, verbose = getOption("arkhe.verbose"))
## S4 method for signature 'ANY'
compact_rows(x, na.rm = FALSE, verbose = getOption("arkhe.verbose"))
Arguments
x |
An R object (should be a |
... |
Currently not used. |
margin |
A length-one |
na.rm |
A |
verbose |
A |
Details
A row/column is empty if it contains only zeros (if of type numeric
)
or zero length character strings (if of type character
).
Author(s)
N. Frerebeau
See Also
Other data preparation tools:
append()
,
assign()
,
count()
,
detect()
,
discard()
,
get()
,
keep()
,
seek()
Examples
## Create a data.frame
X <- data.frame(A = 0, B = 1:5, C = 6, D = "", F = letters[1:5])
X
## Remove empty columns
compact(X, margin = 2)
[Package arkhe version 1.7.0 Index]