This collection of web pages is intended to be a guide to some of the resources for the analysis of spatial data using R, and other associated software. Corrections and contributions are very welcome, and may be made through the mailing list R-sig-Geo, or directly to the site maintainer. Another useful resource is the CRAN Spatial Task View.
Please note that all software and documentation here provided or described is done so "as is" without warranty of any kind.
Spatial data analysis
R spatial projects
Packages on CRAN
Back to GeoDa Center
Package maintainers (email addresses on CRAN descriptions, or package homepages) will be grateful for bug reports, or other questions sent after the package documentation, including where necessary the source code, has been read and found unsatisfactory or insufficient. Contributions of code, documentation, good examples, and fruitful questions are always welcome.
- A full set of course notes on 'Analysing spatial point patterns in R' is now available at: http://www.csiro.au/resources/pf16h.html.
The course is based on the package 'spatstat'. It includes a brief introduction to R, a detailed introduction to the 'spatstat' package, and a discussion of statistical methodology.
- There is an interesting thread on the R-sig-geo mailing list pointing to the SAGA GIS, and the RSAGA interface package just published on CRAN.
- The sp package now includes a change to the creation of SpatialGrid objects; we are seeing two orders of magnitude sppedups, but do not know exactly why.
- Changes in the definitions of many methods between R 2.5.* and 2.6.0 mean that a 2.5.*-installed Matrix package (on which spdep depends) will break spdep (typically round() stops working). The solution is to re-install Matrix in 2.6.0.
- There were R spatial workshops in Helsinki 27-31 August (link) - second half of week with Dennis Helsel - and in London 31 August (link).
- The spatstat package is described in a paper by Adrian Baddeley and Rolf Turner published in the Journal of Statistical Software, 2005: Spatstat: an R package for analyzing spatial point patterns. The package has its own website, including an important note on the forthcoming release 2.
- Edzer Pebesma requests comments on linking R to PostGIS: see his posting on R-sig-geo, and his preliminary results.
- The e-seminar on "Spatio-temporal data analysis in R and links to GIS" given by Edzer Pebesma is now online - please follow these instructions (big 100MB download).
- The spsurvey package for spatial sampling is on CRAN. It can sample points, lines, or polygons using either simple random sampling, unequal probability sampling, stratification. Main focus is on spatially balanced sampling - new approach developed by Stevens and Olsen. spsurvey currently uses ESRI shapefiles as main input but when it reads them in it creates an sp object. The resulting sample is also an sp object.
- Virgilio Gómez-Rubio has announced a preliminary Small Area Estimation package: "to implement EBLUP and Spatial EBLUP estimators (code provided by Nicola Salvati) for Small Area Estimation. The package itself contains a few functions but we have included a vignette that, we hope, is a good starting point to Small Area Estimation with R and can be used for teaching purposes (for example)". It can be found at the Bias project website.
- Following the release of R 2.4.0 , please note that it involves major changes in the handling of objects of classes defined in the sp package. Please make sure to export any objects you need to use to external files before upgrading to R 2.4.0, then upgrade and update packages. The 0.9-* series of the sp package are for R >= 2.4.0, 0.8-* for R <= 2.3.1.
- spBayes is now on CRAN - it is an R package for hierarchical spatial modelling, which will be developed actively. It has been substantially enhanced, and provides functions for fitting separable and non-separable multivariate spatial models with a host of spatial and non-spatial variance structures. Further, this new version is accompanied by an extended vignette and many examples. Additional package information is available on CRAN and here.
- The new Multilevel B-spline Approximation (MBA) R package fits B-spline
surfaces to bivariate scattered data. The mba.surf function is similar to Akima's interp function, but provides improved surface fit characteristics, efficiency for large datasets, and extended functionality. Additional package information is available on CRAN and here.
- I'm very pleased to be able to pass on the excellent news that:
"During the closing plenary of the FOSS4G 2006 conference Markus Neteler was honored with the Sol Katz GFOSS Award for 2006. Markus is the leader of the GRASS GIS project, and has played a pivotal role in the revitalization of the project and it's community. Markus is also a founding member of OSGeo, and has been active in building the broader FOSS4G community for many years."
Markus has a sustained interest in GRASS/R integration, in addition to all the other things he manages to find time to do.
- Scott Fortmann-Roe has posted to R-sig-geo asking for feedback on an improved version of the R k-NNCH script (also known as LoCoH). It will be included in the adehabitat package soon.
- r-spatial foundation classes on SourceForge: sp has been released on CRAN, and is now used directly by maptools, gstat, and spgwr. The use of the classes is documented in Edzer J. Pebesma and Roger S. Bivand (2005) "Classes and methods for spatial data in R", R News 5 (2), pp. 9-13.
- Please note that from the release of package rgdal version 0.4-3, package spproj is withdrawn and is kept in the repository only for archival purposes. Use rgdal fron CRAN, and for projection use the spTransform() method which replaces the transform() method from rgdal 0.4-4.
- From release rgdal_0.4-2, rgdal uses sp classes directly both to read and write SpatialGridDataFrames. The functions: readGDAL() and writeGDAL() also retreive spatial reference system data. It also reads OGR vector data into sp classes directly, using code from Barry Rowlingson's Rmap package, extended and adapted using Radim Blazek's v.in.ogr code from GRASS. Full PROJ.4 is now also available in this package. Both OSX and Linux/Unix users should install using the source package, see further notes here. Finally, it is available for Windows binary installation directly from CRAN and mirrors.
Spatial data analysis with R
A key insight in spatial data analysis is that the "spatial" may add something extra - location may matter in grasping what is driving the data. But it does not have to matter, and good spatial data analysis must also be good data analysis, meeting general requirements for care in handling data and in drawing conclusions. Because R is a very rich environment for general data analysis, it invites spatial analysts to demonstrate clearly that "space" does add insight to analysis, not just assume that this is the case, because the data are spatial.
A further insight is that "spatial" may apply to many fields of data analysis in which the absolute or relative position of observations in relation to each other may have importance, and that methods applied in, for example, sociology or education have direct parallels in "spatial" analysis. Medical imaging is another field of relevance, as indeed are many methods used in examining the relative positions of observations in attribute space. The focus here is on "geographical" spatial data, where observations can be identified with geographical locations, and where additional information about these locations may be retrieved if the location is recorded with care. The date and time of observation are also often of importance. In this connection, geographical information systems (GIS) are very relevant software applications, so that both GIS data formats, and ways to construct maps (thematic or statistical cartography) matter.
Maps and R
Graphical data analysis has always been a strength of S, and thus also of R. S has had a legacy map() function (see here for an R port), based on an internal database format of some sophistication, using a topological representation. It is not easy to add to this database, and other work in R has been to permit the import of foreign formats into the R workspace.
DSC2003 spatial sessions
Many of the contributed packages for spatial data analysis were presented and discussed in contributions to the 2003 Distributed Statistical Computing meeting in Vienna. These papers provide insight into work in progress, and ideas for future contributions, as well as examples of the use of existing packages. Other papers, such as R at the elections, showed how "spatial" contributions are being used by others in the R community.
A number of notes about spatial analysis appeared in R News in 2001-2002, specifically:
- Brian D. Ripley. Spatial Statistics in R. R News, 1(2):14-15, June 2001.
- Paulo J. Ribeiro, Jr. and Peter J. Diggle. geoR: A package for geostatistical analysis. R News, 1(2):15-18, June 2001.
- Martin Schlather. Simulation and analysis of random fields. R News, 1(2):18-20, June 2001.
- Roger Bivand. More on spatial data. R News, 1(3):13-17, September 2001.
- Ole F. Christensen and Paulo J. Ribeiro. geoRglm: A package for generalised linear spatial models. R News, 2(2):26-28, June 2002.