Re: [R] Graphically show population density for a specific geographicarea using R

From: Greg Snow <Greg.Snow_at_intermountainmail.org>
Date: Mon, 21 May 2007 13:28:52 -0600

  1. Yes you need a shape file with that information.
  2. One place to look is: http://www.census.gov/geo/www/cob/bdy_files.html There are shapefiles (the .shp ones) for counties and zip codes (as well as many other things). These work pretty directly with the tools in the maptools and sp packages.
  3. Read the .shp file in using maptools, the .dbf information is automatically read in as well (with whatever details come with the shapefile), then look at the structure of what you read in, you will see the data frame and you should be able to just add your data into that data frame, or use it seperately.
  4. plot.Map has an option auxvar, though it is now prefered to use the plot methods for the more specific objects (SpatialLinesDataFrame object from the readLinesShape function). I would expect that they would have an auxvar or similar argument also. Or you can decide what color you want to use, plot the overall map, then add each county/zipcode individually using the specified color.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow_at_intermountainmail.org
(801) 408-8111
 
 


> -----Original Message-----
> From: r-help-bounces_at_stat.math.ethz.ch
> [mailto:r-help-bounces_at_stat.math.ethz.ch] On Behalf Of Liu, Ningwei
> Sent: Monday, May 21, 2007 1:05 PM
> To: r-help_at_stat.math.ethz.ch
> Subject: [R] Graphically show population density for a
> specific geographicarea using R
>
> Hi,
>
>
> we all know that R is powerful in dealing with graphics.
>
> I am now trying to use R to show some geographic attributes
> for a specific geographic area on a graph. For example, if I
> would like to generate a graph showing the population
> densities (in terms of the intensity of colors) for Illinois
> State by zip codes. I did some research; and it seems that
> package "maptools" is relevant. But I have the following
> couple of questions regarding to the application.
>
> 1. A State is grouped by several counties, and sometimes we
> could further divide it into many areas by zip codes. Will
> there be any differences in the shapefiles (.shp)? Do I need
> to get a specific shapefile in order to graph on a zip code level?
>
> 2. Where can I get this kind of shapefiles?
>
> 3. There is another type of file (.dbf) which includes the
> attributes of a geographic area. It seems I could put the
> population densities in it.
> But then how could I relate it to the shapefile (.shp)? I
> mean how to link a population density to its corresponding
> zip code area?
>
> 4. Finally, how could I use intensity of colors to show the
> differences in the population densities?
>
>
> I would greatly appreciate it if someone could provide me a
> simple example. Thanks a lot!
>
>
> Ningwei
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
______________________________________________ R-help_at_stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Received on Mon 21 May 2007 - 19:39:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 May 2007 - 20:33:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.