Skip to contents

Remove empty rows and columns and constant column

Usage

remove_constants(data, cutoff = 1L)

Arguments

data

The input data frame or linelist

cutoff

The cut-off for empty rows and columns removal. If provided, only rows and columns where the percent of missing data is greater than this cut-off will removed.

Value

The input dataset without the empty rows and columns and the constant columns.

Examples

data <- readRDS(system.file("extdata", "test_df.RDS", package = "cleanepi"))

# introduce an empty column
data$empty_column <- NA

# remove the constant columns, empty rows and columns
dat <- remove_constants(
  data   = data,
  cutoff = 1
)

# check the report to see what has happened
report <- attr(dat, "report")
summary(report)
#>                  Length Class  Mode     
#> empty_columns    1      -none- character
#> constant_columns 1      -none- character