View source: R/closeMatchMatrix.R

closeMatchMatrix | R Documentation |

`closeMatchMatrix`

reorganizes/refines results from simple search of similar values of 2 sets of data by `findCloseMatch`

(as list for one-to many relations) to more human friendly/readable matrix.
This function returns results combining two sets of data which were initially compared (eg measured and threoretical values) as matrix-view using output of `findCloseMatch`

and both original datastes
Additional information (covariables, annotation, ...) may be included as optional columns for either 'predMatr' or 'measMatr'.
Note : It is important to run `findCloseMatch`

with `sortMatch=FALSE`

!
Note : Results presented based on view of 'predMatr', so if multiple 'measMatr' are at within tolared distance, lines of 'measMatr' will be repeated;
Note : Distances 'disToMeas' and 'ppmToPred' are oriented : neg value if measured is lower than predicted (and pos values if higher than predicted);
Note : Returns `NULL`

when nothing within given limits of comparison;

```
closeMatchMatrix(
closeMatch,
predMatr,
measMatr,
prefMatch = c("^x", "^y"),
colPred = 1,
colMeas = 1,
limitToBest = TRUE,
asDataFrame = FALSE,
origNa = TRUE,
silent = FALSE,
callFrom = NULL,
debug = FALSE
)
```

`closeMatch` |
(list) output from |

`predMatr` |
(vector or matrix) predicted values, the column 'colPred' indicates which column is used for matching from |

`measMatr` |
(vector or matrix) measured values, the column 'colMeas' indicates which column is used for matching from |

`prefMatch` |
(character, length=2) prefixes ('^x' and/or '^y') thay may have been added by |

`colPred` |
(integer or text, length=1) column of 'predMatr' with main values of comparison |

`colMeas` |
(integer or text, length=1) column of 'measMatr' with main measures of comparison |

`limitToBest` |
(integer) column of 'measMatr' with main measures of comparison |

`asDataFrame` |
(logical) convert results to data.frame if non-numeric matrix produced (may slightly slow down big results) |

`origNa` |
(logical) will try to use original names of objects 'predMatr','measMatr', if they are not multi-column and not conflicting other output-names (otherwise 'predMatr','measMatr' will appear) |

`silent` |
(logical) suppress messages |

`callFrom` |
(character) allows easier tracking of message(s) produced |

`debug` |
(logical) for bug-tracking: more/enhanced messages |

results as matrix-view based on initial results from `findCloseMatch`

, including optional columns of suppelemental data for both sets of data for comparison. Returns `NULL`

when nothing within limits

`findCloseMatch`

, `checkSimValueInSer`

```
aA <- c(11:17); bB <- c(12.001,13.999); cC <- c(16.2,8,9,12.5,15.9,13.5,15.7,14.1,5)
(cloMa <- findCloseMatch(aA,cC,com="diff",lim=0.5,sor=FALSE))
# all matches (of 2d arg) to/within limit for each of 1st arg ('x'); 'y' ..to 2nd arg = cC
(maAa <- closeMatchMatrix(cloMa,aA,cC,lim=TRUE)) #
(maAa <- closeMatchMatrix(cloMa,aA,cC,lim=FALSE,origN=TRUE)) #
(maAa <- closeMatchMatrix(cloMa,cbind(valA=81:87,aA),cbind(valC=91:99,cC),colM=2,
colP=2,lim=FALSE))
(maAa <- closeMatchMatrix(cloMa,cbind(aA,valA=81:87),cC,lim=FALSE,deb=TRUE)) #
a2 <- aA; names(a2) <- letters[1:length(a2)]; c2 <- cC; names(c2) <- letters[10+1:length(c2)]
(cloM2 <- findCloseMatch(x=a2,y=c2,com="diff",lim=0.5,sor=FALSE))
(maA2 <- closeMatchMatrix(cloM2,predM=cbind(valA=81:87,a2),measM=cbind(valC=91:99,c2),
colM=2,colP=2,lim=FALSE,asData=TRUE))
(maA2 <- closeMatchMatrix(cloM2,cbind(id=names(a2),valA=81:87,a2),cbind(id=names(c2),
valC=91:99,c2),colM=3,colP=3,lim=FALSE,deb=FALSE))
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.