similar: See how closely numeric values match in 2 datasets

View source: R/similar.R

similarR Documentation

See how closely numeric values match in 2 datasets

Description

Compare two vectors, matrices, or data.frames of numbers to see how often they are similar.

Usage

similar(a, b, tol = 99.99, na.rm = FALSE, shownames = TRUE)

Arguments

a

Required first vector, data.frame, or matrix

b

Required second vector, data.frame, or matrix

tol

Number, 99.99 by default, specifying tolerance as a percentage 0-100, such that "similar" is defined as the two values being within 100-tol percent of each other.

na.rm

Logical value, optional, FALSE by default. not implemented here yet. Should NA values be removed first, or compared and treated as NA matches NA.

shownames

Logical value, optional, TRUE by default. Not used. Should names be shown in results?

Details

This function returns a matrix or vector showing how many rows in vector a are within 100-tol percent of the value in vector b. May want to add a 3d case, where NA can match NA.

Value

Data.frame showing what # of rows are "similar" in dataset a vs b, for each column.

See Also

similar.p(), all.equal(), identical(), isTRUE(), ==(), all()

Examples

 similar.p(1:10, (1:10) * 1.001 )
 similar.p(data.frame(x=1:10, y=101:110), data.frame(other=1.001*(1:10),
   other2=c(101:109, 110.01) ))

ejanalysis/analyze.stuff documentation built on April 2, 2024, 10:10 a.m.