donut

Nearest Neighbour Search with Variables on a Torus

https://github.com/paulnorthrop/donut

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 1 committers (100.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.5%) to scientific vocabulary

Keywords

degrees donut edges knn-algorithm knn-search nabor nearest nearest-neighbor nearest-neighbor-search nearest-neighbors nearest-neighbour-algorithm nearest-neighbours neighbors periodicity rann torus wrap
Last synced: 6 months ago · JSON representation

Repository

Nearest Neighbour Search with Variables on a Torus

Basic Info
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 4
Topics
degrees donut edges knn-algorithm knn-search nabor nearest nearest-neighbor nearest-neighbor-search nearest-neighbors nearest-neighbour-algorithm nearest-neighbours neighbors periodicity rann torus wrap
Created over 6 years ago · Last pushed over 2 years ago
Metadata Files
Readme Changelog

README.Rmd

---
output: github_document
---



```{r, echo = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)
```

# donut

[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/paulnorthrop/donut?branch=master&svg=true)](https://ci.appveyor.com/project/paulnorthrop/donut)
[![R-CMD-check](https://github.com/paulnorthrop/donut/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/paulnorthrop/donut/actions/workflows/R-CMD-check.yaml)
[![Coverage Status](https://codecov.io/github/paulnorthrop/donut/coverage.svg?branch=master)](https://app.codecov.io/github/paulnorthrop/donut?branch=master)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/donut)](https://cran.r-project.org/package=donut)
[![Downloads (monthly)](https://cranlogs.r-pkg.org/badges/donut?color=brightgreen)](https://cran.r-project.org/package=donut)
[![Downloads (total)](https://cranlogs.r-pkg.org/badges/grand-total/donut?color=brightgreen)](https://cran.r-project.org/package=donut)

## Nearest Neighbour Search with Variables on a Torus

### What does donut do?

There are several R packages, such as [RANN](https://cran.r-project.org/package=RANN) and [nabor](https://cran.r-project.org/package=nabor) that find the $k$ nearest neighbours in a dataset of specified query points, based on some metric, such as L2 or L1.  The donut package considers the situation where one or more of the variables in the dataset is periodic on a finite interval.  For example, direction is periodic on the interval $(0, 360)$ degrees.  In the small dataset $\{10, 90, 350\}$ degrees 350 is closer to 10 than is 90: 10 and 350 are separated by 20 degrees, 10 and 90 by 80 degrees.

The function `nnt()` finds the $k$ nearest neighbours of each of a set of points of interest, wrapping periodic variables on a torus so that this periodicity is reflected. The user chooses the function to use to find the nearest neighbours.  The nearest neighbour functions from the aforementioned packages are used as examples.

### An example

We use a simple example from the `RANN:nn2()` documentation.  We suppose that both variables should be wrapped, on the ranges $(0, 2\pi)$ and $(0, 3)$ respectively.  We choose the query points of interest to illustrate the wrapping of the variables.  In the plot, query points are indicated with colour-coded crosses and the 8 nearest neighbours of each point are shaded in the same colour.  By default `nnt()` uses the function `RANN::nn2()` (based on the L2 metric) to find the nearest neighbours.

```{r, echo = FALSE}
got_RANN <- requireNamespace("RANN", quietly = TRUE)
```

```{r example, eval = got_RANN}
library(donut)
set.seed(20092019)
x1 <- runif(100, 0, 2 * pi)
x2 <- runif(100, 0, 3)
DATA <- data.frame(x1, x2)
ranges <- rbind(c(0, 2 * pi), c(0, 3))
query <- rbind(c(6, 1.3), c(2 * pi, 3), c(3, 1.5), c(4, 0))
library(RANN)
res2 <- nnt(DATA, query, k = 8, torus = 1:2, ranges = ranges)
plot(res2)
```

### Installation

To get the current released version from CRAN:

```{r installation, eval = FALSE}
install.packages("donut")
```

### Vignette

See `vignette("donut-vignette", package = "donut")` for an overview of the package.

Owner

  • Name: Paul Northrop
  • Login: paulnorthrop
  • Kind: user

GitHub Events

Total
Last Year

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 146
  • Total Committers: 1
  • Avg Commits per committer: 146.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Paul Northrop p****p@u****k 146
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 403 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
cran.r-project.org: donut

Nearest Neighbour Search with Variables on a Torus

  • Versions: 4
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 403 Last month
Rankings
Dependent packages count: 18.7%
Downloads: 19.8%
Average: 27.6%
Forks count: 28.8%
Stargazers count: 35.2%
Dependent repos count: 35.5%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.3.0 depends
  • graphics * imports
  • RANN * suggests
  • knitr * suggests
  • nabor * suggests
  • rmarkdown * suggests
  • testthat >= 2.1.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite