remove_singleton_columns: Remove columns appearing in only 'threshold' row(s) or fewer.

Description Usage Arguments Value Author(s) Examples

View source: R/preprocess_data.R

Description

Removes columns which only have non-zero & non-NA values in threshold row(s) or fewer.

Usage

1
remove_singleton_columns(dat, threshold = 1)

Arguments

dat

dataframe

threshold

Number of rows. If a column only has non-zero & non-NA values in threshold row(s) or fewer, it will be removed.

Value

dataframe without singleton columns

Author(s)

Kelly Sovacool, sovacool@umich.edu

Courtney Armour

Examples

1
2
3
4
remove_singleton_columns(data.frame(a = 1:3, b = c(0, 1, 0), c = 4:6))
remove_singleton_columns(data.frame(a = 1:3, b = c(0, 1, 0), c = 4:6), threshold = 0)
remove_singleton_columns(data.frame(a = 1:3, b = c(0, 1, NA), c = 4:6))
remove_singleton_columns(data.frame(a = 1:3, b = c(1, 1, 1), c = 4:6))

SchlossLab/mikropml documentation built on Nov. 25, 2021, 1:13 p.m.