# NOT RUN {
data(Earthquake)
names(Earthquake)
# collect spatial locations (longitude/latitude) of data.
earthquake <- cbind(Earthquake$longitude, Earthquake$latitude)
library(rgl)
library(sphereplot)
library(geosphere)
#### example 1: principal geodesic analysis (PGA)
PGA(earthquake)
# }
# NOT RUN {
#### example 2: principal circle
circle <- PrincipalCircle(earthquake) # get center and radius of principal circle
PC <- GenerateCircle(circle[1:2], circle[3]) # generate Principal circle
# plot
sphereplot::rgl.sphgrid()
sphereplot::rgl.sphpoints(earthquake, radius = 1, col = "blue", size = 12)
sphereplot::rgl.sphpoints(PC, radius = 1, col = "red", size = 9)
#### example 3: spherical principal curves (SPC, SPC.Hauberg)
SPC(earthquake) # spherical principal curves.
SPC.Hauberg(earthquake) # principal curves by Hauberg on sphere.
#### example 4: local principal geodesics (LPG)
LPG(earthquake, scale = 0.5, nu = 0.2, maxpt = 20)
LPG(earthquake, scale = 0.4, nu = 0.3)
# }
Run the code above in your browser using DataLab