Learn R Programming

ribiosUtils (version 1.7.7)

corByRownames: Calculate correlation coefficients using common rows of the two matrices

Description

Calculate correlation coefficients using common rows of the two matrices

Usage

corByRownames(mat1, mat2, ...)

Value

A matrix of the dimension \(m \times n\), where m and n are number of columns in mat1 and mat2, respectively. The matrix has an attribute, commonRownames, giving the common rownames shared by the two matrices.

Arguments

mat1

A numeric matrix

mat2

Another numeric matrix

...

Passed cor At least two rows of both matrices must share the same names, otherwise the function will report an error.

Examples

Run this code
myMat1 <- matrix(rnorm(24), nrow=6, byrow=TRUE,
  dimnames=list(sprintf("R%d", 1:6), sprintf("C%d", 1:4)))
myMat2 <- matrix(rnorm(35), nrow=7, byrow=TRUE,
  dimnames=list(sprintf("R%d", 7:1), sprintf("C%d", 1:5)))
corByRownames(myMat1, myMat2)

Run the code above in your browser using DataLab