find_min_dists: For all points in matrix 1, return the distance to and index...

Description Usage Arguments Author(s) Examples

View source: R/find_min_dists.R

Description

Find the shortest distance between each point in one data set and the points in a second set.

This function determines the distance between every point in mOne and the nearest point in mTwo.

Usage

1
find_min_dists(mOne, mTwo)

Arguments

mOne

A numeric matrix where each row is a localization and each column is a spatial axis.

mTwo

A numeric matrix with the same number of columns as mOne.

Author(s)

Zach Colburn

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Generate random data.
set.seed(10)

mOne <- as.matrix(data.frame(
x = rnorm(10),
y = rbinom(10, 100, 0.5),
z = runif(10)
))

mTwo <- as.matrix(data.frame(
x = rnorm(20),
y = rbinom(20, 100, 0.5),
z = runif(20)
))

# Find the minimum distance between each point in mOne and the points in
# mTwo.
find_min_dists(mOne, mTwo)

Bioi documentation built on Jan. 11, 2020, 9:23 a.m.