View source: R/findSimilFrom2sets.R
findSimilFrom2sets | R Documentation |
findSimilFrom2sets
compares to vectors or matrixes and returns combined view including only all close (by findCloseMatch
).
Return matrix (predMatr) with add'l columns for index to and 'grp' (group of similar values (1-to-many)), 'nGrp' (n of grp), 'isBest' or 'nBest', 'disToMeas'
(distance/difference between pair) & 'ppmToPred' (distance in ppm).
Note: too wide 'limitComp' will result in large window and many 'good' hits will compete (and be mutually exlcuded) if selection 'bestOnly' is selected
findSimilFrom2sets(
predMatr,
measMatr,
colMeas = 1,
colPre = 1,
compareTy = "diff",
limitComp = 0.5,
bestOnly = FALSE,
silent = FALSE,
callFrom = NULL,
debug = FALSE
)
predMatr |
(matrix or numeric vector) dataset number 1, referred to as 'predicted', the colum speified in argument |
measMatr |
(matrix or numeric vector) dataset number 2, referred to as 'measured', the colum speified in argument |
colMeas |
(integer) which column number of 'measMatr' to consider |
colPre |
(integer) which column number of 'predMatr' to consider |
compareTy |
(character) 'diff' (difference) 'ppm' (relative difference) |
limitComp |
(numeric) limit used by 'compareTy' |
bestOnly |
(logical) allows to filter only hits with min distance (defined by 'compareTy'), 3rd last col will be 'nBest' - otherwise 3rd last col 'isBest' |
silent |
(logical) suppress messages |
callFrom |
(character) allow easier tracking of messages produced |
debug |
(logical) for bug-tracking: more/enhanced messages |
This function returns a matrix (predMatr) with add'l columns for index to and 'grp' (group of similar values (1-to-many)), 'nGrp' (n of grp), 'isBest' or 'nBest', 'disToMeas' (distance/difference between pair) & 'ppmToPred' (distance in ppm)
checkSimValueInSer
findCloseMatch
closeMatchMatrix
aA <- c(11:17); bB <- c(12.001,13.999); cC <- c(16.2,8,9,12.5,12.6,15.9,14.1)
aZ <- matrix(c(aA,aA+20),ncol=2,dimnames=list(letters[1:length(aA)],c("aaA","aZ")))
cZ <- matrix(c(cC,cC+20),ncol=2,dimnames=list(letters[1:length(cC)],c("ccC","cZ")))
findCloseMatch(cC,aA,com="diff",lim=0.5,sor=FALSE)
findSimilFrom2sets(aA,cC)
findSimilFrom2sets(cC,aA)
findSimilFrom2sets(aA,cC,best=FALSE)
findSimilFrom2sets(aA,cC,comp="ppm",lim=5e4,deb=TRUE)
findSimilFrom2sets(aA,cC,comp="ppm",lim=9e4,bestO=FALSE)
# below: find fewer 'best matches' since search window larger (ie more good hits compete !)
findSimilFrom2sets(aA,cC,comp="ppm",lim=9e4,bestO=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.