ismember {matlab2r} | R Documentation |
Array elements that are members of set array
Description
Checks which members of one entity are in another
Usage
ismember(A, B, rows = FALSE, indices = FALSE)
## S4 method for signature 'data.frame,data.frame'
ismember(A, B, rows = FALSE, indices = FALSE)
Arguments
A |
a vector, matrix or dataframe |
B |
another vector, matrix or dataframe |
rows |
if |
indices |
if |
Value
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.
Author(s)
Waldir Leoncio
Examples
# 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)
[Package matlab2r version 1.5.0 Index]