R for Spatial Statistics


Installing R and RStudio

In Review

Installing "R"

To install "R", go to the R web site and click on "CRAN". The organizations that support R all help with it's distribution so you'll need to select a location to download R from. Click on the link to "Download R for ..." for your operating system and then click on "base". The additional options for for those who want to download and compile R or develop additional packages for R.

After installing "R", check and make sure that it is available on your computer. For MS-Windows, this is through the "Start" menu where you should find both a 32-bit (i386) and a 64-bit (x64) version. I recommend using the version that matches your computer's operating system. For MS-Windows computers, this can be found by right clicking on "My Computer" and selecting "Properties". Select the appropriate version and you should see the "RGui" appear. This is the R Graphical User Interface that comes with R.

Installing "R Studio"

R Studio makes it easier to use R by displaying plots and data sets in a more user-friendly way. This web site assumes that you'll be using R Studio but can also be used with the RGui, you'll just need to adapt a few of the instructions for RGui.

Go to the R Studio web site download page and click on "Download for Desktop". This will guide you through installing the appropriate version of R Studio for your computer. When done, make sure that "R Studio" is available on your computer and that you can open it.

Installing Packages

Most of the code for R is in "packages" that have been developed by a large variety of organizations. The packages can include a number of libraries. You don't have to worry too much about whether you have a package installed or not, just include a library that you want to use and you'll receive an error that: "there is no package called '...'". To install a package, select "Install Packages..." from the "Tools" menu in RStudio. Select any CRAN site that is close to you and then enter the name of the package. You should see that it is installed in the console.

You may have problems with some of the packages. The quality of package varies but the documentation is very consistent.