which_are_constant {dataPreparation} | R Documentation |

## Identify constant columns

### Description

Find all the columns that are constant.

### Usage

```
which_are_constant(data_set, keep_cols = NULL, verbose = TRUE)
```

### Arguments

`data_set` |
Matrix, data.frame or data.table |

`keep_cols` |
List of columns not to drop (list of character, default to NULL) |

`verbose` |
Should the algorithm talk (logical, default to TRUE) |

### Details

Algorithm is performing exponential search: it check constancy 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 data_set set is, the more interesting it is to use this function.

### Value

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

### Examples

```
# Let's load our data_set
data(tiny_messy_adult)
# Let's try our function
which_are_constant(tiny_messy_adult)
# Indeed it return constant the name of the constant column.
```

[Package

*dataPreparation*version 1.1.1 Index]