[R-sig-Geo] Question on symmetric for nb2mat

Roger Bivand Roger@B|v@nd @end|ng |rom nhh@no
Wed Jul 29 17:19:31 CEST 2020


Please follow-up in this thread posting in plain text (not HTML). As you 
can see below, HTML garbles your message.

On Wed, 29 Jul 2020, Andrea Gilardi wrote:

> Dear all, probably I'm missing something obvious but I have a question on
> the matrix built using nb2mat with argument style = "B". More precisely, I
> don't understand why the following code says that the matrix *W* (which
> should be a binary first-order adjacency matrix) is not symmetric:
>
>
>
>
>
>
>
>
>
>
>
>
>
> *library(spdep)library(rgdal)library(Matrix)# datanc.sids <-
> readOGR(system.file("shapes/sids.shp", package = "spData"))adj <-
> poly2nb(nc.sids)W <- as(nb2mat(adj, style = "B"),
> "Matrix")Matrix::isSymmetric(W)#> [1] FALSEchol(W)#> Error in
> asMethod(object): not a symmetric matrix; consider forceSymmetric() or
> symmpart()*
>
> Kind regards
> Andrea
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en



More information about the R-sig-Geo mailing list