Hi,
You could have a look at the sp-package, it provides R-classes for
spatial data. In addition, it also provides very nice plotting
facilities. To read your data into these sp classes you can use the
rgdal package. There is also an R mailing list specifically for
geographic data (r-sig-geo) which might be a more suitable place to get
good replies.
cheers,
Paul
Donald Braman wrote:
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@r-project.org 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.
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 274 3113 Mon-Tue
Phone: +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul
______________________________________________
R-help@r-project.org 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.