Learn R Programming

arkhe (version 1.4.0)

remove_constant: Remove Constant Columns

Description

Remove Constant Columns

Usage

remove_constant(x, ...)

# S4 method for ANY remove_constant(x, na.rm = FALSE)

Arguments

x

An R object (should be a matrix or a data.frame).

...

Currently not used.

na.rm

A logical scalar: should NA values be stripped before the computation proceeds?

Author

N. Frerebeau

See Also

Other data cleaning tools: compact(), count(), detect(), discard(), empty, infinite, keep(), missing, zero

Examples

Run this code
## Create a data.frame
X <- data.frame(A = 1, B = 1:3)
X

remove_constant(X)

## Add NA
X[1, 1] <- NA
remove_constant(X)
remove_constant(X, na.rm = TRUE)

Run the code above in your browser using DataLab