compare_rows: Compare rows in a matrix

View source: R/compare_rows.R

compare_rowsR Documentation

Compare rows in a matrix

Description

For all pairs of rows in a matrix, calculate the proportion of mismatches or the RMS difference.

Usage

compare_rows(mat, method = c("prop_mismatches", "rms_difference"))

Arguments

mat

Numeric matrix. Should be integers in the case method="prop_mismatches".

method

Indicates whether to use proportion mismatches or the RMS difference. Missing values are omitted.

Value

A square matrix of dimension nrow(mat) with NAs on the diagonal and the calculated statistic in the body.

Examples

n <- 10
p <- 200
x <- matrix(sample(1:4, n*p, replace=TRUE), ncol=p)
d <- compare_rows(x)

kbroman/broman documentation built on Feb. 11, 2024, 7:18 a.m.