chooseCN
is a simple interface to
build a connection network (CN) from xy coordinates. The user chooses
from 6 types of graph. chooseCN
calls functions from
appropriate packages, handles non-unique coordinates and returns a
connection network either with classe nb
or listw
.chooseCN(xy, ask = TRUE, type = NULL, result.type = "nb", d1 = NULL,
d2 = NULL, k = NULL, a=NULL, dmin=NULL, plot.nb = TRUE, edit.nb = FALSE)
type
is
provided.spdep
package. See details.type=5.
type=5
.type=6
.type=7
.type=7
.nb
or
listw
. The xy coordinates are passed as attribute to the
created object.listw
object, even if nb
was requested.spca
data(nancycats)
if(require(spdep) & require(ade4)){
par(mfrow=c(2,2))
cn1 <- chooseCN(nancycats@other$xy,ask=FALSE,type=1)
cn2 <- chooseCN(nancycats@other$xy,ask=FALSE,type=2)
cn3 <- chooseCN(nancycats@other$xy,ask=FALSE,type=3)
cn4 <- chooseCN(nancycats@other$xy,ask=FALSE,type=4)
par(mfrow=c(1,1))
}
Run the code above in your browser using DataLab