[R] Trouble with Spatial Data Example Script
John Kane
jrkrideau at inbox.com
Sat Aug 11 15:02:57 CEST 2012
As David Carlson mentioned earlier your script is working well for me.
sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i686-pc-linux-gnu (32-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_CA.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] sp_0.9-99
loaded via a namespace (and not attached):
[1] fortunes_1.5-0 grid_2.15.1 lattice_0.20-6
John Kane
Kingston ON Canada
> -----Original Message-----
> From: lorenzo.isella at gmail.com
> Sent: Fri, 10 Aug 2012 22:20:56 +0200
> 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.
____________________________________________________________
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails
More information about the R-help
mailing list