Description Usage Arguments Details Value Author(s) See Also Examples
Find all neighbors within a given distance for each point in a data set.
1 | findNeighbors(X, threshold, ..., BNINDEX, BNPARAM)
|
X |
A numeric data matrix where rows are points and columns are dimensions. |
threshold |
A numeric scalar or vector specifying the maximum distance for considering neighbors. |
... |
Further arguments to pass to specific methods.
This is guaranteed to include |
BNINDEX |
A BiocNeighborIndex object containing precomputed index information.
This can be missing if |
BNPARAM |
A BiocNeighborParam object specifying the algorithm to use.
This can be missing if |
The class of BNINDEX
and BNPARAM
will determine the dispatch to specific functions.
Only one of these arguments needs to be defined to resolve dispatch.
However, if both are defined, they cannot specify different algorithms.
If BNINDEX
is supplied, X
does not need to be specified.
In fact, any value of X
will be ignored as all necessary information for the search is already present in BNINDEX
.
Similarly, any parameters in BNPARAM
will be ignored.
If both BNINDEX
and BNPARAM
are missing, the function will default to the KMKNN algorithm by setting BNPARAM=KmknnParam()
.
A list is returned containing index
, a list of integer vectors specifying the identities of the neighbors of each point;
and distance
, a list of numeric vectors containing the distances to those neighbors.
See ?"rangeFind-methods"
for more details.
Aaron Lun
rangeFindKmknn
and rangeFindVptree
for specific methods.
1 2 3 4 5 6 7 8 9 10 11 | Y <- matrix(rnorm(100000), ncol=20)
k.out <- findNeighbors(Y, threshold=3)
a.out <- findNeighbors(Y, threshold=3, BNPARAM=VptreeParam())
k.dex <- buildKmknn(Y)
k.out2 <- findNeighbors(Y, threshold=3, BNINDEX=k.dex)
k.out3 <- findNeighbors(Y, threshold=3, BNINDEX=k.dex, BNPARAM=KmknnParam())
v.dex <- buildVptree(Y)
v.out2 <- findNeighbors(Y, threshold=3, BNINDEX=v.dex)
v.out3 <- findNeighbors(Y, threshold=3, BNINDEX=v.dex, BNPARAM=VptreeParam())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.