repeating_column: Check if all values in a column are the same

Description Usage Arguments Details Value Examples

View source: R/utilities.R

Description

Checks if all values in a column are the same, works for any type of data

Usage

1
repeating_column(x, roundx = NULL)

Arguments

x

Vector of values

roundx

Only use if data is numeric, rounds the calculated variance if a value is given

Details

Be careful using the roundx argument. e.g. repeating_column(c(1, 1, 1.0001), roundx = 8) will return TRUE.

Value

Logical

Examples

1
2
3
4
5
6
7
8
repeating_column(rep(1, 5))

repeating_column(c("dog", "dog", "dog", "cat"))

# Use with purrr to test multiple columns

testdf <- data.frame(x = rep(1, 5), y = c(1, 2, 1, 1, 1))
purrr::map_lgl(testdf, ~ repeating_column(.))

AndBooth/Rutils documentation built on May 28, 2019, 11:04 a.m.