ismember | R Documentation |
Checks which members of one entity are in another
ismember(A, B, rows = FALSE, indices = FALSE) ## S4 method for signature 'data.frame,data.frame' ismember(A, B, rows = FALSE, indices = FALSE)
A |
a vector, matrix or dataframe |
B |
another vector, matrix or dataframe |
rows |
if |
indices |
if |
a binary vector telling if the corresponding A indices are in B. If
indices = TRUE
, also prints the index in B where the match first
occurs.
Waldir Leoncio
# Values that are members of set A <- c(5, 3, 4, 2) B <- c(2, 4, 4, 4, 6, 8) ismember(A, B) # Members of set and indices to values ismember(A, B, indices = TRUE) # Table rows found in another table A <- data.frame( "V1" = 1:5, "V2" = LETTERS[1:5], "V3" = as.logical(c(0, 1, 0, 1, 0)) ) B <- data.frame( "V1" = seq(1, 9, 2), "V2" = LETTERS[seq(1, 9, 2)], "V3" = as.logical(rep(0, 5)) ) ismember(A, B)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.