Description Usage Arguments Details Value Author(s) Examples
Find the nearest neighbors of a set of query points in the same or another set of points in an n-dimensional real vector space, using the Euclidean distance.
1 | matchpt(x, y)
|
x |
A matrix (or vector) of coordinates.
Each row represents a point in an |
y |
Optional, matrix (or vector) with the same number of columns
as |
If y
is provided, the function searches
for each point in x
its nearest neighbor in y
.
If y
is missing, it searches
for each point in x
its nearest neighbor in x
,
excluding that point itself.
In the case of ties, only the neighbor with the smaller index is given.
The implementation is simple and of complexity nrow(x)
times
nrow(y)
. For larger problems, please consider one of the many
more efficient nearest neighbor search algorithms.
A data.frame
with two columns and nrow(x)
rows.
The first column is the index of the nearest neighbor,
the second column the distance to the nearest neighbor.
If y
was given, the index is a row number in y
,
otherwise, in x
. The row names of the result are those of x
.
Oleg Sklyar osklyar@ebi.ac.uk
1 2 3 4 5 6 7 |
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, basename, cbind, colMeans, colSums, colnames,
dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
intersect, is.unsorted, lapply, lengths, mapply, match, mget,
order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
union, unique, unsplit, which, which.max, which.min
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
index distance
A 5 2.236068
B 3 5.099020
C 4 2.236068
D 3 2.236068
E 1 2.236068
index distance
1 4 0.30
2 4 0.70
3 7 0.45
4 1 0.30
5 5 0.40
index distance
1 4 0.30
2 3 0.80
3 5 2.90
4 1 0.30
5 5 0.40
6 1 7.00
7 3 0.45
8 3 0.68
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.