This function calculates reconstruction error.
Cal.recon(data, line)
matrix or data frame consisting of spatial locations with two columns. Each row represents longitude and latitude.
longitude and latitude of a line as a matrix or data frame with two columns.
summation of squared distance from the data to the line on the unit sphere.
This function calculates reconstruction error from the data to the line. Longitude should range from -180 to 180 and latitude from -90 to 90. This function requires to load 'geosphere' R package.
# NOT RUN {
library(geosphere) # This function needs to load 'geosphere' R packages.
data <- rbind(c(0, 0), c(50, -10), c(100, -70))
line <- rbind(c(30, 30), c(-20, 50), c(50, 80))
Cal.recon(data, line)
# }
Run the code above in your browser using DataLab