Skip to contents

Remove Constant Columns

Usage

remove_constant(x, ...)

# S4 method for class 'ANY'
remove_constant(x, na.rm = FALSE, verbose = getOption("arkhe.verbose"))

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?

verbose

A logical scalar: should R report extra information on progress?

See also

Author

N. Frerebeau

Examples

## Create a data.frame
X <- data.frame(A = 1, B = 1:3)
X
#>   A B
#> 1 1 1
#> 2 1 2
#> 3 1 3

remove_constant(X)
#>   B
#> 1 1
#> 2 2
#> 3 3

## Add NA
X[1, 1] <- NA
remove_constant(X)
#>    A B
#> 1 NA 1
#> 2  1 2
#> 3  1 3
remove_constant(X, na.rm = TRUE)
#>   B
#> 1 1
#> 2 2
#> 3 3