Learn R Programming

dataPreparation (version 0.1)

whichAreConstant: Identify constant columns

Description

Find all the columns that are constant.

Usage

whichAreConstant(dataSet, verbose = TRUE)

Arguments

dataSet

Matrix, data.frame or data.table

verbose

Should the algorithm talk (logical, default to TRUE)

Value

List of column's indexes that are constant in the dataSet set.

Details

Algorithm is constance equality by exponential search: it check constance on row 1 to 10, if it's ,not constant it stops, if it's constant then on 11 to 100 ... If you have a lot of columns than aren't constant, this function is way faster than a simple length(unique())! The larger the dataSet set is, the more interesting it is to use this function.

Examples

Run this code
# NOT RUN {
# Let's load our dataSet
data("messy_adult") 

# Lets try our function
whichAreConstant(messy_adult)
# Indeed it return constant the name of the constant column.
# }

Run the code above in your browser using DataLab