compress | R Documentation |
Function to remove or restore redundant or empty elements from a data object.
compress(x, ...)
## S3 method for class 'data.frame'
compress(x, keep = "", na.rm = TRUE, remove = "", unique = FALSE, ...)
expand(x, ...)
## S3 method for class 'data.frame'
expand(x, keep, ...)
x |
Data object. |
... |
Not used. |
keep |
Data object. |
na.rm |
Logical value specifying whether to remove columns containing only NA values. columns containing only NA values. |
remove |
Character string(s) specifying other column contents to be treated as empty. |
unique |
Logical value specifying whether to remove columns that contain only a single unique value. |
compress(data.frame)
: Remove empty data columns.
x <- data.frame(year = 2018, count = rpois(10, 5), survey = "scs", group = rep(1:2, each = 5))
x <- compress(x)
print(x)
attributes(x)
attr(x, "status") <- "critical"
expand(x)
attr(x, "units") <- c(length = "millimeters", weight = "grams")
expand(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.