compact | R Documentation |
Removes empty rows/columns in an array-like object.
compact(x, ...)
compact_columns(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_columns(x, na.rm = FALSE, verbose = getOption("arkhe.verbose"))
## S4 method for signature 'ANY'
compact_rows(x, na.rm = FALSE, verbose = getOption("arkhe.verbose"))
x |
An R object (should be a |
... |
Currently not used. |
margin |
A length-one |
na.rm |
A |
verbose |
A |
A row/column is empty if it contains only zeros (if of type numeric
)
or zero length character strings (if of type character
).
N. Frerebeau
Other data preparation tools:
append_column()
,
append_rownames()
,
assign()
,
count()
,
detect()
,
discard()
,
get()
,
keep()
,
seek()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.