Description Usage Arguments Value Examples
Sample points based on distance matrix so that distance between any pair is not less than a fixed radius. This will not preserve density, but does preserve local outliers.
1  | 
d | 
 object of class 'dist'  | 
radius | 
 (numeric) radius around a point  | 
seed | 
 (positive integer) A seed. Default is 1.  | 
... | 
 Arguments for   | 
Index of condensed points
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  | library("magrittr")
dataset <- rbind(
  MASS::mvrnorm(1000, mu = c(0, 0), Sigma = matrix(c(1, 0.3, 0.3, 1), 2))
  , MASS::mvrnorm(100, mu = c(10, 10), Sigma = matrix(c(1, 0.3, 0.3, 1), 2))
  , MASS::mvrnorm(10, mu = c(5, 5), Sigma = matrix(c(1, 0.3, 0.3, 1), 2))
  , MASS::mvrnorm(10, mu = c(0, 8), Sigma = matrix(c(1, 0.3, 0.3, 1), 2))
  , MASS::mvrnorm(10, mu = c(7, 0), Sigma = matrix(c(1, 0.3, 0.3, 1), 2))
  )
plot(dataset)
do <- dist(dataset)
dbscan::kNNdist(do, 4) %>% apply(1, median) %>% summary()
ci <- condense(do, 0.103)
dataset[ci, ] %>% plot()
dataset[condense(do, 0.68), ] %>% plot()
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.