File: nbdists.Rd

package info (click to toggle)
r-cran-spdep 1.1-5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,012 kB
  • sloc: ansic: 1,489; sh: 16; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 1,266 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
% Copyright 2001 by Roger S. Bivand
\name{nbdists}
\alias{nbdists}
\title{Spatial link distance measures}
\description{
  Given a list of spatial neighbour links (a neighbours list of object type
  \code{nb}), the function returns the Euclidean distances along the links
  in a list of the same form as the neighbours list. If longlat = TRUE, Great
  Circle distances are used.
}
\usage{
nbdists(nb, coords, longlat = NULL)
}
\arguments{
  \item{nb}{an object of class \code{nb}}
  \item{coords}{matrix of point coordinates or a SpatialPoints object}
  \item{longlat}{TRUE if point coordinates are longitude-latitude decimal degrees, in which case distances are measured in kilometers; if coords is a SpatialPoints object, the value is taken from the object itself}
}
\value{
A list with class \code{nbdist}
}
\author{Roger Bivand \email{Roger.Bivand@nhh.no}}

\seealso{\code{\link{summary.nb}}, \code{\link{nb2listw}}}

\examples{
columbus <- st_read(system.file("shapes/columbus.shp", package="spData")[1], quiet=TRUE)
col.gal.nb <- read.gal(system.file("weights/columbus.gal", package="spData")[1])
coords <- coordinates(as(columbus, "Spatial"))
dlist <- nbdists(col.gal.nb, coords)
dlist <- lapply(dlist, function(x) 1/x)
stem(unlist(dlist))
}
\keyword{spatial}