# NOT RUN {
library(rgl)
library(sphereplot)
library(geosphere)
#### example 1: earthquake data
data(Earthquake)
names(Earthquake)
earthquake <- cbind(Earthquake$longitude, Earthquake$latitude)
# }
# NOT RUN {
SPC.Hauberg(earthquake, q = 0.1)
# }
# NOT RUN {
#### example 2: waveform data
## longitude and latitude are expressed in degrees
n <- 200
alpha <- 1/3; freq <- 4 # amplitude and frequency of wave
sigma <- 2 # noise level
lon <- seq(-180, 180, length.out = n) # uniformly sampled longitude
lat <- alpha * 180/pi * sin(freq * lon * pi/180) + 10. # latitude vector
## add Gaussian noises on latitude vector
lat1 <- lat + sigma * rnorm(length(lon))
wave <- cbind(lon, lat1)
## implement principal curves by Hauberg to the waveform data
# }
# NOT RUN {
SPC.Hauberg(wave, q = 0.05)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab