Search code examples
rsimplifydouglas-peucker

Could not find the "DouglasPeuckerEpsilon" in R language


I'm trying to use Douglas Peucker's algorithm in R. By executing the following code, I get the following error:

Px <- (1:100)/10
Py <- dnorm(Px,3,1)+dnorm(Px,7,1)+Px/10

### Example 1
### Simplification using epsilon

par(mfrow=c(2,2))
plot(Px,Py,type="l")
plot(DouglasPeuckerEpsilon(Px,Py,0.01),type="b",col=4)
Could not find the "DouglasPeuckerEpsilon" in R language.

This is because I do not have the DP package installed?


Solution

  • Perform the following Steps:

    1. Install the package (kmlShape)
    2. Then load the Library (kmlShape)

      install.packages("kmlShape")
      
      library("kmlShape")
      

    Then run plot(DouglasPeuckerEpsilon(Px,Py,0.01),type="b",col=4) for Ramer-Douglas-Peucker algorithm (RDP)