powered by
Removes empty rows/columns in an array-like object.
compact(x, ...)compact_columns(x, ...)compact_rows(x, ...)# S4 method for ANY compact(x, margin = 1, na.rm = FALSE, verbose = getOption("arkhe.verbose"))# S4 method for ANY compact_columns(x, na.rm = FALSE, verbose = getOption("arkhe.verbose"))# S4 method for ANY compact_rows(x, na.rm = FALSE, verbose = getOption("arkhe.verbose"))
compact_columns(x, ...)
compact_rows(x, ...)
# S4 method for ANY compact(x, margin = 1, na.rm = FALSE, verbose = getOption("arkhe.verbose"))
# S4 method for ANY compact_columns(x, na.rm = FALSE, verbose = getOption("arkhe.verbose"))
# S4 method for ANY compact_rows(x, na.rm = FALSE, verbose = getOption("arkhe.verbose"))
An R object (should be a matrix or a data.frame).
matrix
data.frame
Currently not used.
A length-one numeric vector giving the subscripts which the function will be applied over (1 indicates rows, 2 indicates columns).
numeric
1
2
A logical scalar: should NA values be stripped before the computation proceeds?
logical
NA
A logical scalar: should R report extra information on progress?
N. Frerebeau
A row/column is empty if it contains only zeros (if of type numeric) or zero length character strings (if of type character).
character
Other data preparation tools: append_column(), append_rownames(), assign(), count(), detect(), discard(), get(), keep(), seek()
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)
Run the code above in your browser using DataLab