similar.p | R Documentation |
Compare two vectors, matrices, or data.frames of numbers to see how often they are similar.
similar.p(a, b, tol = 99.99, na.rm = FALSE)
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. |
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.
Data.frame showing what % of rows are "similar" in dataset a vs b, for each column.
similar()
, all.equal()
, identical()
, isTRUE()
, ==()
, all()
similar(1:10, (1:10) * 1.001 )
similar(
data.frame(x=1:10, y=101:110),
data.frame(other=1.001*(1:10), other2=c(101:109, 110.01) )
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.