whichVecInMat {apComplex} | R Documentation |
This functions checks if a vector is identical to or strictly less than at least one column in a matrix, and returns the indices of the respective columns.
whichVecInMat(x, mat, compare = "equal")
x |
A vector. |
mat |
A matrix with number of rows equal to the length of x . |
compare |
A character equal to "equal" (default) or "less". |
If compare
is set to "equal", the function checks to see if x
is identically equal to at least one column in mat
and records the indices of the matching columns.
If compare
is set to "less", the function checks to see if all elements of x
are less than all elements of at least one column in mat
and records the corresponding column indices.
A vector of column names of mat
, or indices if the columns are not named, that are identical to or greater than x
.
Denise Scholtens
reduceMat
,reduceMatNew
,vecInMat
a <- matrix(c(1,0,1,1,1,0),nrow=3) x1 <- c(1,0,1) x2 <- c(1,1,1) x3 <- c(1,0,0) whichVecInMat(x1,a) whichVecInMat(x2,a) whichVecInMat(x3,a,compare="less")