R for Spatial Statistics


About "R"

R is an "Open Source" software program that is one of the most popular statistics packages. R allows "libraries" to be added relatively simply and R is very fast even on large data sets. R was not built specifically for spatial statistics but you do execute a huge number of spatial statistical functions within R. R is available for MS-Windows, UNIX, and Linux operating systems.

The native R user interface a command-line application where you type in commands and hit "Enter" to see the results of each command. However, this is a rather cumbersome way to do statistics. R commands can be combined together into "R Scripts" to create programs that are much easier to execute, modify, and maintain. Most R users then work in an R development environment, either the one provided with R or RStudio. We'll be working in R-Studio because it provides quick visual access to data sets.

R is not inherently "spatially aware" (i.e. it does not understand GIS file formats and georeferencing). However, almost all of its functions could be used with spatial data by exporting the data to a file format that R works with (typically CSV), running R, and then importing the outputs back into a GIS application. In addition, there are now libraries that allow R to work with spatial data directly but we'll look at these a little later in the course.

This gives us the structure shown below.