mat.mat: Number of equal columns between two matrices

View source: R/matrix.R

Number of equal columns between two matricesR Documentation

Number of equal columns between two matrices

Description

Number of equal columns between two matrices.

Usage

mat.mat(x, y)

Arguments

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.

Details

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.

Value

A numerical vector of size equal to the number of columns of x.

Author(s)

Manos Papadakis

R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr> and Manos Papadakis <papadakm95@gmail.com>.

See Also

Match, colmeans, colMedians

Examples

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

Rfast documentation built on Nov. 9, 2023, 5:06 p.m.