RDP

Ramer-Douglas-Peucker algorithm for R

https://github.com/robertdj/rdp

Science Score: 26.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
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.2%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Ramer-Douglas-Peucker algorithm for R

Basic Info
  • Host: GitHub
  • Owner: robertdj
  • License: gpl-3.0
  • Language: C++
  • Default Branch: main
  • Size: 146 KB
Statistics
  • Stars: 9
  • Watchers: 2
  • Forks: 9
  • Open Issues: 0
  • Releases: 0
Created over 5 years ago · Last pushed about 3 years ago
Metadata Files
Readme License

README.Rmd

---
output: github_document
---



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

set.seed(1337)
```

RDP
===


[![CRAN status](https://www.r-pkg.org/badges/version/RDP)](https://CRAN.R-project.org/package=RDP)
[![R build status](https://github.com/robertdj/RDP/workflows/R-CMD-check/badge.svg)](https://github.com/robertdj/RDP/actions)
[![Codecov test coverage](https://codecov.io/gh/robertdj/RDP/branch/main/graph/badge.svg)](https://codecov.io/gh/robertdj/RDP)


The {RDP} package contains an implementation of the [Ramer–Douglas–Peucker algorithm
](https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm) for reducing the number of points in a curve.

There are other R packages that offer implementations of the Ramer–Douglas–Peucker algorithm, but {RDP} has only a single dependency and it executes pretty fast.


# Installation

{RDP} is [available on CRAN](https://cran.r-project.org/package=RDP) and can be installed with the command

``` r
install.packages("RDP")
```

{RDP} can also be installed from GitHub with the [{remotes} package](https://remotes.r-lib.org) using this command:

``` r
remotes::install_github("robertdj/RDP")
```


# Example

There is a single function in the {RDP} package.
Here is an example from the Wikipedia page linked to above with a description of the algorithm.
The original line is black and the approximating line is red.

```{r example}
x <- seq(from = 0, to = 5, by = 0.01)
y <- exp(-x) * cos(2 * pi * x)
plot(x, y, type = "l")

lines(RDP::RamerDouglasPeucker(x, y, 0.06), col = "red", lty = 2)
```


# Performance

Here is a comparison of the execution speed and memory usage of the {RDP} implementation and a pure R implementation from the [{kmlShape} package](https://cran.r-project.org/package=kmlShape):

```{r timing}
x <- as.double(1:10^4)
y <- rnorm(length(x))
bench::mark(
    RDP = RDP::RamerDouglasPeucker(x, y, epsilon = 0.1),
    kmlShape = kmlShape::DouglasPeuckerEpsilon(x, y, epsilon = 0.1)
)
```

In this example we see from the [{bench} package](https://bench.r-lib.org) summary that {RDP} is several 1000 times faster and only use a fraction of the memory.


# Acknowledgements

The C++ code was *originally* based on [a Gist from TimSC](https://gist.github.com/TimSC/0813573d77734bcb6f2cd2cf6cc7aa51), but over time it has been almost completely rewritten.


# License

This package is almost exclusively C++ code that is linked against R.
[As explained in Rcpp's FAQ](http://dirk.eddelbuettel.com/code/rcpp/Rcpp-FAQ.pdf) this leaves me no option but to use GPL.

Owner

  • Name: Robert Dahl Jacobsen
  • Login: robertdj
  • Kind: user
  • Location: Denmark

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 161
  • Total Committers: 2
  • Avg Commits per committer: 80.5
  • Development Distribution Score (DDS): 0.012
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Robert Dahl Jacobsen g****t@d****k 159
andrie a****s@g****m 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 1
  • Total pull requests: 30
  • Average time to close issues: 5 days
  • Average time to close pull requests: about 7 hours
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.1
  • Merged pull requests: 30
  • 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
  • andrie (1)
Pull Request Authors
  • robertdj (28)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 315 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 8
  • Total maintainers: 1
cran.r-project.org: RDP

The Ramer-Douglas-Peucker Algorithm

  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 315 Last month
Rankings
Forks count: 9.1%
Stargazers count: 24.2%
Dependent packages count: 29.8%
Average: 32.1%
Dependent repos count: 35.5%
Downloads: 61.9%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • Rcpp * imports
  • testthat * suggests
  • withr * suggests
  • zeallot * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v2 composite