| coincident | R Documentation |
coincident takes the coordinate matrices
coords1 and coords2 and returns the indices
of the coincident coordinates of the two matrices.
coincident(coords1, coords2)
coords1 |
An |
coords2 |
An |
This function calls a compiled C++ program created
using the Rcpp package. This (may) result in a significant
speedup over pure R code since the search algorithm
involves loops. We assume that there are no duplicate
coordinates in coords1 and coords2,
respectively. In other words, each row of coords1 is
unique and each row of coords2 is unique. There is
at most 1 row of coords1 that will match with a row
in coords2.
Returns a matrix with the indices of the coincident
locations. Specifically, an r \times 2 matrix will be
returned, with r being the number of coordinates in
coords1 coinciding with coordinates in
coords2. If row i of the matrix is c(2, 5),
then the ith set of coincident locations is between
the 2nd row of coords1 and the 5th row of
coords2. If there are no coincident locations, then
a matrix of size 0 \times 2 is returned.
Joshua French
#Generate two sets of coordinates
loc1 <- as.matrix(expand.grid(seq(0, 1, len = 25), seq(0, 1, len = 25)))
loc2 <- as.matrix(expand.grid(seq(0, 1, len = 101), seq(0, 1, len = 101)))
coincident(loc1, loc2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.