The function makes a "spatial neighbour"
object representation
(similar to the S-PLUS spatial statististics module representation of a
"listw"
spatial weights object. sn2listw()
is the inverse function to listw2sn()
, creating a "listw"
object from a "spatial neighbour"
object. The as.spam.listw
method converts a "listw"
object to a sparse matrix as defined in the spam package, using listw2sn()
.
listw2sn(listw)
sn2listw(sn)
as.spam.listw(listw)
a listw
object from for example nb2listw
a spatial.neighbour
object
listw2sn()
returns a data frame with three columns, and with class spatial.neighbour
:
region number id for the start of the link (S-PLUS row.id)
region number id for the end of the link (S-PLUS col.id)
weight for this link
# NOT RUN {
if (require(rgdal, quietly=TRUE)) {
example(columbus)
col.listw <- nb2listw(col.gal.nb)
col.listw$neighbours[[1]]
col.listw$weights[[1]]
col.sn <- listw2sn(col.listw)
str(col.sn)
# }
# NOT RUN {
col.sp <- as.spam.listw(col.listw)
str(col.sp)
# }
# NOT RUN {
}
# }
Run the code above in your browser using DataLab