A Custom R Function

Doug Nychka’s fields package in R is really excellent. Among its nice functions is a command world() that draws an outline of the continents. I wrote him today inquiring whether there was an option in which land could be colored. Unfortunately there wasn’t. However by the end of the day, there was. Doug sent me a function world.color() which yielded the following pretty map.

world1.gif

It will be included in the next release of fields, but in the meantime CA readers can download the function here

library(fields) #load the package
source(“http://data.climateaudit.org/scripts/world.color.R”) #download function
world.color()

You can handle this like the world() function where you can use xlim and ylim delimiters as in a plot function; you can use the add=T option if you want to overlay on a plot of points to make a location map. Thanks, Doug.

4 Comments

  1. Fred
    Posted Nov 25, 2007 at 6:26 PM | Permalink

    Blue & Gold . . . so you are a closet Bomber fan ??

  2. thetruthwillsetyoufree
    Posted Nov 25, 2007 at 6:30 PM | Permalink

    Nah….a Highlanders’ fan from Otago.

  3. Posted Nov 26, 2007 at 11:01 AM | Permalink

    Is Mercator the best projection?

    Have you considered something like the Dymaxion Projection (onto an icosa)?

  4. Posted Nov 26, 2007 at 11:20 AM | Permalink

    When you show weightings by area is the area referenced to the map (high latitudes get larger areas) or are the area independent of the map area?

    That is one of the main failings of Mercator – it does not show areas properly. Dymaxion is better in that respect.