Pages Menu
TwitterRss
Categories Menu

Posted by on Sep 6, 2010 in R Spatial, Resources | 6 comments

R Maps

This is an updated version of my Making Maps with R tutorial. I think the code is lot simpler and it also includes some data for you to play around with.

Background:

Spatial data are becoming increasingly common, as are the tools available in R to process it. Of course one of the best ways of visualizing spatial data is through a map. Maps need to be well thought out. Not least, the selected colours need to be appropriate and sufficient context is provided through the use of a legend, title, scale bar and north arrow. The worksheet will demonstrate how to produce a map with R that includes all these elements.

Data Requirements:

London Sport Participation Shapefile. Download (requires unzipping)

Install the following packages (if you haven’t already done so):

maptools, RColorBrewer, classInt

Click here to view the tutorial code.

Share on Facebook
Bookmark this on Google Bookmarks
Share on reddit
Bookmark this on Digg
Share on StumbleUpon
Share on LinkedIn

6 Comments

  1. Hi.

    You didn’t tag this post with “r” so it didn’t appear on R-bloggers.com

    If you want more visitors – please add the “r” tag.

    Cheers :)
    Tal

  2. Readers may also like to try the spplot function from package sp .

  3. Advise pls. An new 2 R. Trying 2 map a shp based on ur guide. After loading the packages on R2.15, attempts 2 read the file generates error, Error: could not find function “readShapePoly”.

    Tnx in advance.

  4. Hello,

    @afro: have you installed the maptools package?

    My comment:
    When plotting the legend, I get the error that objects of type “closure” cannot be indexed.
    I know that there is no support with the scripts but maybe some visitor happens to know.

    I appreciate these scripts very much James, thank you!

    regards,
    Ludwig

  5. @afro: I had the same error message, but I eventually discovered that the directory that I had set up didn’t hold all of the necessary files (there should be five london_sport files: .shp, .dbf, .prj, .sbn, and .shx). You might want to check that they’re all in the same workind directory.

    Hope this helps.

    • The answer to the question how can I get a six pack of abs has eluded nearly all men and women for what seems an eternity.
      It will also discuss how a person can remove the fats store in the body and how to tone their muscles properly.

      Whenever you bend, twist, your ab muscles are being used for stabilization and
      shifting of power.

Trackbacks/Pingbacks

  1. Making Maps with R - Spatial Analysis - [...] ***This tutorial has been updated, please click here*** [...]
  2. Making Maps with R | GIS Lounge - [...] of Spatial Data  in R.  The Spatial Analysis site has an introductory tutorial entitled, “Making Maps with R“.  James …
  3. R: dica de sites e tutorial para criação de mapas - [...] Making Maps with R [...]
  4. Map Attribute Data in R using GGPLOT2 | Getting Under the Water - [...] but it could include a few more things. Think of this code as a mix between Cheshire’s posts …

Post a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>