Tools for Working with Multidimensional Data

Provides various tools for working with multidimensional data in R and C++, including extremely fast nearest-neighbor- and range- queries without the overhead of linked tree nodes.

The kdtools package exports a C++ header implementing sorting and searching on ranges of tuple-like objects without using trees. It is based on a kd-tree-like recursive sorting algorithm. Once sorted, one can perform a range- or nearest-neighbor- query. More details are here. Methods and benchmarks are here.

x = kd_sort(matrix(runif(400), 200))
plot(x, type  = 'l', asp = 1, axes = FALSE, xlab = NA, ylab = NA)
points(x, pch = 19, col = rainbow(200, alpha = 0.25), cex = 2)
y = kd_range_query(x, c(1/4, 1/4), c(3/4, 3/4))
points(y, pch = 19, cex = 0.5, col = "red")

CRAN status Travis build status AppVeyor build status Coverage status DOI


kdtools 0.3.1

  • Additional bug fixes

kdtools 0.3.0

  • Bug fix in lower/upper_bound

kdtools 0.2.0

  • For upload to CRAN

kdtools 0.1.1

  • Added a file to track changes to the package.
  • Fixed a bug in vignette building

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.3.1 by Timothy Keitt, a year ago

Report a bug at

Browse source code at

Authors: Timothy Keitt [aut, cre]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports Rcpp

Suggests testthat, knitr, rmarkdown, covr, ggplot2, tidytext, printr, scales

Linking to Rcpp, strider, BH

See at CRAN