[R] Trouble with Spatial Data Example Script

David L Carlson dcarlson at tamu.edu
Fri Aug 10 23:43:34 CEST 2012


The script is working for me. Did you get any error or warning messages? What version of R are you using? What operating system does your computer use? When the command, print(load(con)), runs, what message do you see?

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Lorenzo Isella
> Sent: Friday, August 10, 2012 3:21 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Trouble with Spatial Data Example Script
> 
> Dear All,
> I need to do something relatively simple: generate a map of Europe and
> paint the various states with different colors (only 3-4 are needed)
> according to a rule.
> I would like to keep it as simple as possible and the script resorting
> to
> the sp package that I found at
> 
> http://bit.ly/Oc71ub
> 
> is exactly what I am looking for (I need to repeat the exercise with
> Europe instead of Switzerland and to have a legend).
> However, when I try to run the script (which I also paste at the end of
> the email), well, nothing happens and I certainly do not see a map of
> Switzerland.
> I am not familiar with the sp package, but am I missing the obvious?
> Any help is appreciated.
> Best Regards
> 
> Lorenzo
> 
> ########################################à
> 
> library(sp)
> con <- url("http://gadm.org/data/rda/CHE_adm1.RData")
> print(load(con))
> close(con)
> 
> 
> 
> language <- c("german", "german", "german","german",
>   "german","german","french", "french",
>   "german","german","french", "french",
>   "german", "french","german","german",
>   "german","german","german", "german",
>   "german","italian","german","french",
>   "french","german","german")
> gadm$language <- as.factor(language)
> col = rainbow(length(levels(gadm$language)))
> spplot(gadm, "language", col.regions=col, main="Swiss Language
> Regions")
> 
> ###########################################
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list