View source: R/general_utils.R
all_same | R Documentation |
Check if all values in a vector are the same. It is robust also to NA values
that can be handled with the na.rm
parameter
all_same(x, na.rm = FALSE)
x |
a vector |
na.rm |
logical indicating whether |
logical vector
all_same(c(1,1,1)) # TRUE
all_same(c(1,2,3)) # FALSE
all_same(c(1,1,NA)) # FALSE
all_same(c(1,1,NA), na.rm = TRUE) # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.