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

remove_empty {janitor} | R Documentation

## Remove empty rows and/or columns from a data.frame.

### Description

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

### Usage

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

### Arguments

`dat` | the input data.frame.
`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 data.frame without its missing rows or columns.

### Examples

    # not run:
    # dat %>% remove_empty("rows")

[Package janitor version 1.0.0 Index]