[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-geo
Subject:    Re: [R-sig-Geo] neighborly ordering of spdf data/spacetime
From:       Chris English <sglish () hotmail ! com>
Date:       2012-05-26 14:21:25
Message-ID: SNT117-W296FED0DF6557481212BF7C5060 () phx ! gbl
[Download RAW message or body]


Robert,

Thank you, it performs exactly as desired.  Until you

shared the extraction notation, I could not have conceived how

it might look, but now looks natural:

combine the thing itself 5, with neighbors of 5 and their data.

I take note of Dr. Pebesma's query as to why I would want to do

this, and it may amount to simplifying some report graphics as

against any analytical objectives.  But, to be seen.  I'm going to

continue working with this neighbor approach to see if it helps with

organizing data frames as I move into states and counties where

I have little or no prior knowledge of how counties are placed.

Thanks again,

Chris

Date: Thu, 24 May 2012 14:32:52 -0700
Subject: Re: [R-sig-Geo] neighborly ordering of spdf data/spacetime
From: r.hijmans@gmail.com
To: sglish@hotmail.com
CC: r-sig-geo@r-project.org

Chris, 
You can get the neighbors of a polygon from the nb object. For example, after you do \
this: nb <- poly2nb(nj_cty_2.spdf)

the neighbors of polygon 5 would be
nb[[5]]
And you can extract them all (and plot them) like this
pol5andngb <-  nj_cty_2.spdf [ c(5, nb[[5]]),  ] 

Robert
On Thu, May 24, 2012 at 1:54 PM, Chris English <sglish@hotmail.com> wrote:



Hello,

I am exploring some US county level housing data.  I started with New Jersey and \
built a SPDF and subsequently a STFDF.  Data and spatial were in alphabetical order \
that madematching straight forward.

The problem arises that alphabetically named spatial attributes, i.e. atlantic, \
bergen (counties),are not close physically, indeed, often not neighbors.

When trying to plot a variable of interest among some neighboring counties instead of \
the wholestate, hudson, bergen, essex, for example, many other counties have to be \
plotted because the SPDF was created in alphabetical order.


I've spent the afternoon looking at spdep and deriving various neighbor, for example:

 > nj_cty_hu_nb <- poly2nb(nj_cty_2.spdf)> summary(nj_cty_hu_nb)Neighbour list \
object:Number of regions: 21 Number of nonzero links: 82 Percentage nonzero weights: \
18.5941 Average number of links: 3.904762 Link number distribution:


2 3 4 5 6 7 3 5 7 4 1 1 3 least connected regions:cape may hudson salem with 2 links1 \
most connected region:morris with 7 links

Basically I'm wondering if someone can suggest how I might go back and recreate my \
spatial polygonsobject ordered by a more optimal neighbor approach and thence \
construct a new spdf based upon amore neighborly order than a-z.


Thanks in advance,Chris





        [[alternative HTML version deleted]]



_______________________________________________

R-sig-Geo mailing list

R-sig-Geo@r-project.org

https://stat.ethz.ch/mailman/listinfo/r-sig-geo


 		 	   		  
	[[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic