Description Usage Arguments Value See Also Examples
Checks if all values in a vector are the same.
Uses unique
1 | is.constant(x, na.rm = FALSE, ...)
|
x |
vector |
na.rm |
exclude missing values before checking if the data in x is constant |
... |
other arguments passed to unique |
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
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.