Learn R Programming

janitor (version 1.2.0)

remove_empty: Remove empty rows and/or columns from a data.frame or matrix.

Description

Removes all rows and/or columns from a data.frame or matrix that are composed entirely of NA values.

Usage

remove_empty(dat, which = c("rows", "cols"))

Arguments

dat

the input data.frame or matrix.

which

one of "rows", "cols", or c("rows", "cols"). Where no value of which is provided, defaults to removing both empty rows and empty columns, declaring the behavior with a printed message.

Value

Returns the object without its missing rows or columns.

See Also

remove_constant() for removing constant columns.

Other remove functions: remove_constant

Examples

Run this code
# NOT RUN {
# not run:
# dat %>% remove_empty("rows")
# }

Run the code above in your browser using DataLab