Learn R Programming

spherepc (version 0.1.7)

Cal.recon: Calculating reconstruction error

Description

This function calculates reconstruction error.

Usage

Cal.recon(data, line)

Arguments

data

matrix or data frame consisting of spatial locations with two columns. Each row represents longitude and latitude.

line

longitude and latitude of a line as a matrix or data frame with two columns.

Value

summation of squared distance from the data to the line on the unit sphere.

Details

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.

Examples

Run this code
# 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