Author Login
Post Reply
You may want to use the state.vbm data from the TeachingDemos package (along with the maptools package), see the examples and help file for state.vbm.
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@(protected)
801.408.8111
> -----Original Message-----
> From: r-help-bounces@(protected)-
> project.org] On Behalf Of Donald Braman
> Sent: Thursday, July 02, 2009 7:12 PM
> To: r-help
> Subject: [R] mapping states with colors
>
> Hi folks,
> I'm just learning how to use maps. As an initial foray, I'm mapping
> the
> states that have "duty to retreat" (blue) and "stand your ground" (red)
> self-defense standards. Here is my extremely naive script:
>
> dtr <- c('alabama', 'arizona', 'conneticut', 'delaware', 'dist of
> columbia'
> , 'hawaii', 'maryland', 'massachusetts', 'minnesota', 'missouri',
> 'nebraska'
> , 'new hampshire', 'new jersey', 'new mexico', 'new york', 'north
> carolina'
> , 'north dakota', 'ohio', 'pennsylvania', 'rhode island', 'virginia',
> 'wyoming', 'arkansas', 'vermont')
>
>
> syg <- c( 'alaska', 'california', 'colorado', 'florida', 'georgia',
> 'idaho'
> , 'illinois', 'indiana', 'iowa', 'kansas', 'kentucky', 'louisiana',
> 'maine'
> , 'michigan', 'mississippi', 'montana', 'nevada', 'oklahoma', 'oregon',
> 'south
> carolina', 'south dakota', 'tennessee', 'texas', 'utah', 'washington',
> 'west
> va', 'wisconsin')
>
>
> map('state', proj='bonne', param=50,
>
> region = c(syg, dtr),
>
> fill=TRUE,
>
> col=c('red', 'blue'))
>
> Obviously that doesn't work. A couple questions:
>
> 1. How do I get Alaska & Hawaii on the map?
> 2. How to I set the col atttribute for a subset of the states I'm
> mapping?
>
> Many thanks in advance for any help!
>
> Don
>
> Donald Braman
> http://www.culturalcognition.net
> http://ssrn.com/author=286206
> http://www.law.gwu.edu/Faculty/profile.aspx?id=10123
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@(protected)
> 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@(protected)
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.