Number of equal columns between two matrices | R Documentation |
Number of equal columns between two matrices.
mat.mat(x, y)
x |
A numerical matrix. See details for more information. It must have the same number of rows as y. |
y |
A numerical matrix. See details for more information. It must have the same number of rows as x. |
The function takes each column of x and checks the number of times it matches a column of y. In the example below, we take the first 3 columns of iris as the x matrix. The y matrix is the whole of iris. We will see how many times, each column of x appears in the y matrix. The answer is 1 for each column.
A numerical vector of size equal to the number of columns of x.
Manos Papadakis
R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr> and Manos Papadakis <papadakm95@gmail.com>.
Match, colmeans, colMedians
x <- as.matrix(iris[, 1:3])
y <- iris
y[, 5] <- as.numeric(y[, 5])
y <- as.matrix(y)
res<-mat.mat(x, y)
x<-y<-NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.