isIncluded | R Documentation |
Check if a vector of values is included in another vector of values
isIncluded(values, parentValues)
values |
A vector of values. |
parentValues |
A vector of values where |
Returns TRUE
if the value or all values
(if it's a vector) are
present in the parentValues
; FALSE
otherwise.
# check if a column is present in dataframe A <- data.frame( col1 = c(1, 2, 3), col2 = c(4, 5, 6), col3 = c(7, 8, 9) ) isIncluded("col3", names(A)) # TRUE # check if single element is present in a vector (atomic or non-atomic) isIncluded("x", list("w", "x", 1, 2)) # TRUE isIncluded("x", c("w", "a", "y")) # FALSE # check if **all** values (if it's a vector) are contained in parent values isIncluded(c("x", "y"), c("a", "y", "b", "x")) # TRUE isIncluded(list("x", 1), list("a", "b", "x", 1)) # TRUE isIncluded(c("x", "y"), c("a", "b", "x")) # FALSE isIncluded(list("x", 1), list("a", "b", "x")) # FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.