R/intra.point.dist.R

Defines functions intra.point.dist

Documented in intra.point.dist

#' Intra point/position distance
#' 
#' For a data frame of positions return the vector of intra point distances
#' 
#' 
#' @param x List of positions with components \code{lat} and \code{lon}.
#' @return Vector of distances between the points in \code{x}.
#' @seealso \code{\link{arcdist}}
#' @keywords arith
#' @examples
#' 
#' # distances along the perimeter of a statistical rectangle
#' pos <- rPeri(323)
#' intra.point.dist(pos)
#' sum(intra.point.dist(pos))
#' 
#' @export intra.point.dist
intra.point.dist <-
function(x)
{
	n <- length(x$lat)
	arcdist(x$lat[ - n], x$lon[ - n], x$lat[-1], x$lon[-1])
}

Try the geo package in your browser

Any scripts or data that you put into this service are public.

geo documentation built on May 29, 2017, 5:36 p.m.