Skip to contents

Similar to janitor::remove_constant, except this function aims to identify the constant columns without removing them. If there are no constant columns, it will return NA.

Usage

cols_constant(data, na.rm = FALSE)

cols_unary(data, na.rm = FALSE)

Arguments

data

The data frame

na.rm

Should missing values be removed?

Value

A character vector of constant columns.

Examples

df <- data.frame(x1 = 1, x2 = c("A", "B", "C"), x3 = "a")
cols_constant(df)
#> [1] "x1" "x3"