Example: stock market

rworldmap: A New R package for Mapping Global Data

CONTRIBUTEDRESEARCHARTICLES35rworldmap: A New R package forMapping Global Databy Andy SouthAbstractrworldmapis a relatively new pack-age available on CRAN for the Mapping and vi-sualisation of Global data. The vision is to makethe display of Global data easier, to facilitate un-derstanding and communication. The initial fo-cus is on data referenced by country or grid dueto the frequency of use of such data in Global as-sessments. Tools to link data referenced by coun-try (either name or code) to a map, and then todisplay the map are provided as are functions tomap Global gridded data. Country and griddedfunctions accept the same arguments to specifythe nature of categories and colour and how leg-ends are formatted.

rworldmap data inputs rworldmap consists of tools to visualise global data and focuses on two types of data. Firstly, data that are referenced by country codes or names and sec-ondly, data that are referenced on a grid. Country data There is a wealth of global country level data avail-able on the internet including UN population data,

Tags:

  Rworldmap

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of rworldmap: A New R package for Mapping Global Data

1 CONTRIBUTEDRESEARCHARTICLES35rworldmap: A New R package forMapping Global Databy Andy SouthAbstractrworldmapis a relatively new pack-age available on CRAN for the Mapping and vi-sualisation of Global data. The vision is to makethe display of Global data easier, to facilitate un-derstanding and communication. The initial fo-cus is on data referenced by country or grid dueto the frequency of use of such data in Global as-sessments. Tools to link data referenced by coun-try (either name or code) to a map, and then todisplay the map are provided as are functions tomap Global gridded data. Country and griddedfunctions accept the same arguments to specifythe nature of categories and colour and how leg-ends are formatted.

2 This package builds on thefunctionality of existing packages, particularlysp,maptoolsandfields. Example code is pro-vided to produce maps, to link with the pack-agesclassInt,RColorBrewerandncdf, and toplot examples of publicly available country andgridded datasets are becoming increasingly commonand are frequently seen on the web, in journal pa-pers and in our newspapers (for example a carbonatlas of Global emissions available ). At the same timethere is a greater interest in Global issues such as cli-mate change, the Global economy, and poverty (asfor example outlined in the Millenium DevelopmentGoals, ). Thirdly, there is an increasing availability ofsoftware tools for visualising data in new and inter-esting ways.

3 Gapminder ( ) has pioneered making UN statistics more avail-able and intelligible using innovative visualisationtools and Many Eyes ( )provides a very impressive interface for sharing dataand creating maps have become so common that theyhave even attracted Onion s Atlas ofthe Planet Earth (The Onion, 2007), contains a BonoAwareness world map representing the intensitywith which artist Bono is aware of the plight anddaily struggles of region , with a categorisation rang-ing from has heard of nation once through movedenough by nations crisis to momentarily remove sun-glasses to cares about welfare of nation nearly asmuch as his own.

4 There appears to be a gap in the market forfree software tools that can be used across disci-plinary boundaries to produce innovative, publica-tion quality Global visualisations. Within R there aregreat building blocks (particularlysp,maptoolsandfields) for spatial data but users previously had to gothrough a number of steps if they wanted to produceworld maps of their own data. Experience has shownthat difficulties with linking data and creating classi-fications, colour schemes and legends, currently con-strains researchers ability to view and display globaldata. We aim to reduce that constraint to allow re-searchers to spend more time on the more importantissue of what they want to display.

5 The vision forrworldmapis to produce a package to facilitate thevisualisation and Mapping of Global data. Becausethe focus is on Global data, the package can be morespecialised than existing packages, making worldmapping easier, partly because it doesn t have to dealwith detailed local maps. Throughrworldmapweaim to make it easy for R users to explore their globaldata and also to produce publication quality figuresfrom their partly inspired and largelyfunded by the UK Natural Environment ResearchCouncil (NERC) program Quantifying Uncertaintyin Earth System Science (QUEST). This programbrings together scientists from a wide range of dis-ciplines including climate modellers, hydrologistsand social was apparent that whileresearchers have common tools for visualisationwithin disciplines, they tend to use different onesacross disciplines and that this limits the sharingof data and methods necessary for truly interdis-ciplinary research.

6 Within the project, climate andearth system modellers tended to use IDL, ecologistsArcGIS, hydrologists and social scientists Matlab andfisheries scientists R. With the exception of R, thesesoftware products cost thousands of pounds whichacts as a considerable constraint on users being ableto try out techniques used by collaborators. Thishigh cost and learning curve of adopting new soft-ware tools hinders the sharing of data and methodsbetween disciplines. To address this, part of the vi-sion forrworldmapwas to develop a tool that can befreely used and modified across a multi-disciplinaryproject, to facilitate the sharing of scripts, data andoutputs. Such freely available software offers greateropportunity for collaboration with research institutesin developing countries that may not be able to af-ford expensive R Journal Vol.

7 3/1, June 2011 ISSN 2073-485936 CONTRIBUTEDRESEARCHARTICLES rworldmap data inputsrworldmapconsists of tools to visualise Global dataand focuses on two types of data. Firstly, data thatare referenced by country codes or names and sec-ondly, data that are referenced on a dataThere is a wealth of Global country level data avail-able on the internet including UN population data,and many Global indices for, among others: Envi-ronmental Performance, Global Hunger and Multi-dimensional are commonly referenced by country namesas these are the most easily recognised by users,but country names have the problem that vocabu-laries are not well conserved and many countrieshave a number of subtly different alternate names( Ivory Coast and Cote d Ivoire, Laos and Peo-ple s Democratic Republic of Lao).

8 To address thisproblem there are ISO standard country codes of ei-ther 2 letters, 3 letters or numeric, and also 2 letterFIPS country codes, so there is still not one univer-sally adopted all ofthese country codes and offers tools to help whendata are referenced by names or other dataGlobal datasets are frequently spatially referencedon a grid, because such gridded or raster data for-mats offer advantages in efficiency of data storageand processing. Remotely sensed data and other val-ues calculated from it are most frequently availablein gridded formats. These can include terrestrial ormarine data or are many gridded data formats, here I willconcentrate on two: ESRI GridAscii and GridAscii files are an efficient way of storingand transferring gridded data.

9 They are straightfor-ward text files so can be opened by any text have a short header defining the structure ofthe file ( number, size and position of rows andcolumns), followed by a single row specifying thevalue at each grid cell. Thus they use much less spacethan if the coordinates for each cell had to be start of gridAscii file for a half degreeglobal grid:ncols 720nrows 360xllcorner -180yllcorner -90cellsize -999-999 1 0 1 1 .. [all 259200 cell values]NetCDF is a data storage file format com-monly used by climate scientists and oceanogra-phers. NetCDF files can be multi-dimensional, (x,y)data for multiple attributes over mul-tiple months, years, days etc.

10 The packagencdfisgood for reading data from netCDF functionalityrworldmaphas three core functions outlined belowand others that are described ()joins user countrydata referenced by country names or codes toa map to enable ()plots a map of country ()plots a map of gridded dataJoining country data to a mapTo join the data to a map will need to specify the name of column contain-ing your country identifiers (nameJoinColumn) andthe type of code used (joinCode) "ISO3" for ISO3 letter codes or "UN" for numeric country (countryExData)sPDF <- joinCountryData2 Map( countryExData,joinCode = "ISO3",nameJoinColumn = "ISO3V10")This code outputs, to the R console, a summary ofhow many countries are successfully joined.