is.constant: Checks if all values in a vector are the same

Description Usage Arguments Value See Also Examples

Description

Checks if all values in a vector are the same.
Uses unique

Usage

1
is.constant(x, na.rm = FALSE, ...)

Arguments

x

vector

na.rm

exclude missing values before checking if the data in x is constant

...

other arguments passed to unique

Value

returns TRUE if all the data in x have the same value, else it returns FALSE. For vectors of length 0, returns a logical element of length zero

See Also

unique

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- c(1,1,1,1,NA)
is.constant(x)
is.constant(x, na.rm=TRUE)
x <- 1:100
is.constant(x)
is.constant(numeric(0))
## Not run: 
is.constant(list(x = 1:10))

## End(Not run)

jwijffels/LStat documentation built on May 20, 2019, 6:26 a.m.