Displaying 6 results from an estimated 6 matches for "nb2mat".
Did you mean:
bmat
2013 Nov 20
2
Multiple if statement in loop condition
...clause.
Phalaen wrote
> Hi!
> I am a Phd student in the university of Padua and I am trying to write a
> little script (the first!) to make a simulation on epidemiology.
> I'd like to change the values of a vector of 883 values basing on a
> neighbour matrix constructed with nb2mat from a shapefile: if i and j (two
> cells) are neighbour (matrix) and i or j have a positive value in the
> vector, I'd like to transform the value of both i and j to 1 (positive),
> otherwise the value of i and j should remain 0. When I launch the next
> little script:
>
> f...
2011 May 07
1
spdep::poly2nb problem
...):
library(rgdal) # Version: 0.6-28
library(spdep) # Version: 0.5-24 (loads sp: Version: 0.9-72)
# read in the data
states<-readOGR(".","s_01de10")
summary(states)
# now create a neighbors list
states_nb<-poly2nb(states)
# create a 0/1 matrix of the neighbors
nb_mat<-nb2mat(states_nb,style="B",zero.policy=TRUE)
# add names
nms<-as.character(states$NAMES)
# set the matrix names
dimnames(nb_mat)<-list(nms,nms)
# now see which states have no neighbors
rowSums(nb_mat)
# it turns out that Florida seems to have zero neighbors.
I then repeated it with
stat...
2010 Jun 20
3
Spatial: number of independent components?
Hi all, I am sorry if this is a very basic quesion, but I have no experience
with analyzing spatial data and could not find the right function/package
quickly. Any hints would be much appreciated. I have a matrix of spatial
point patterns like the one below and want to find the number of independent
components (if that's the right term) in that matrix (or in that image).
x=matrix(c(0,1,0,0,0,
2002 May 30
1
neighbor.grid and spatial.weights
Anyobody knows if functions neighbor.grid and spatial.weights (from
module spatial) have any 'equivalents' in R ?
Thanks.
JA
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the
2008 Mar 31
1
GeoDa spdep
My question is in regard to the spdep and GeoDa packages. Do you know how
to extract a neighborhood/adjacency matrix from R? I need a matrix that has
all the neighborhoods on the X and Y axis, and then a r=1 when the
neighborhoods touch, and a r=0 when neighborhoods don't touch. I
think the Moran's I functions use a matrix like this when they estimate
Moran's I. I can estimate
2012 Feb 26
1
Matrix problem to extract animal associations
Dear List,
I have been trying to extract associations from a matrix whereby individual locations are within a certain distance threshold from one another.
I have been able to extract those individuals where there is 'no interaction' (i.e. where these individuals are not within a specified distance threshold from another individual) and give these individuals a unique Group ID containing