create_balls {mappeR} | R Documentation |
Make a cover of balls
Description
Make a cover of balls
Usage
create_balls(data, dists, eps)
Arguments
data |
A data frame. |
dists |
A distance matrix for the data frame. |
eps |
A positive real number. |
Value
A list of vectors of data point names, one list element per ball. The output is such that every data point is contained in a ball of radius \varepsilon
, and no ball center is contained in more than one ball. The centers are datapoints themselves.
Examples
num_points = 5000
P.data = data.frame(
x = sapply(1:num_points, function(x)
sin(x) * 10) + rnorm(num_points, 0, 0.1),
y = sapply(1:num_points, function(x)
cos(x) ^ 2 * sin(x) * 10) + rnorm(num_points, 0, 0.1),
z = sapply(1:num_points, function(x)
10 * sin(x) ^ 2 * cos(x)) + rnorm(num_points, 0, 0.1)
)
P.dist = dist(P.data)
balls = create_balls(data = P.data, dists = P.dist, eps = .25)
[Package mappeR version 1.3.0 Index]