R

From Intamap

Contents

R introductory material

Intro material can be obtained from the R website, http://www.r-project.org , -> Manuals or -> Books. Strongly recommend are the books by Venables and Ripley, "Modern Applied Statistics with S" and "S Programming".

R for spatial data

For the spatial task view, go to r-project.org -> CRAN -> CRAN mirror (which I will now call CRAN), -> Task Views -> Spatial (and end up e.g. here)

On the task view you'll see there is considerable work going on in geostatistics for R.

Packages that may be worth checking out are gstat (linear geostatistics), geoR and geoRglm (model-based geostatistics) and RandomFields (by Martin Schlather, who has worked with Tillman Gneiting).

Edzer's teaching material is at this site. My teaching material is not public (but I will open it for INTAMAP; ask Edzer for the logon/passwd) Answers to questions are in webct, I may be able to add you or your students to this system.

See this link for examples of reprojection coordinate systems within R.

R and automatic interpolation

Paul Hiemstra wrote an R package that performs an automatic interpolation by using an automatic variogram fitting procedure already present in R (package gstat). The fit.variogram procedure requires an initial estimate for the variogram parameters, the R package provides these initial estimates. The code is listed in a public CVS on sourceforge and can be downloaded as a tar.gz file here. Windows users could use the program 7zip to extract the tar.gz file. If you want to install the package on a Windows computer you can download the Windows .zip binary file here. Assuming that you have installed R (2.40 or higher) the installation of the package is done by taking these steps.

  • Start Rgui from the windows manual
  • From the menu choose Packages -> Install packages from local zip file(s).
  • Point the dialog to the automap zip file and press OK.
  • Relax and sit back while R installs the package.

For installing the package in Linux you can download the tar.gz source file . If you downloaded the code to /tmp/automap_x.x-x.tar.gz, go to /tmp/ and give the following command:

R CMD INSTALL automap_x.x-x.tar.gz

The package is now available in R. Start a new R session and give the following commands:

> library(automap)
> demo(automap)

This should start a demo which demonstrates the automap package on heavy metal concentrations near the river Meuse in the southern part of the Netherlands. The package requires two additional packages, gstat and sp (available through CRAN). Your R version should be 2.4.0 or higher.

R and matlab

See this note. While searching I also came across an R package R.matlab, which allows binary exchange of R and matlab objects. Don't know whether it's of any use.

R and SOAP

There is an R package that allows R to be accessed through the SOAP protocol. In that way it can be used for remote calls. It uses Python in combination with the Python module soappy. The connection between python and R is done through Rpy

See also:

  • RSOA: R and interoperability

R miscellaneous

Here you can put all your information on R editors, good tutorials on beginner and advanced level, good books on R etc etc.

  • A nice reference card for R is listed here.
  • A good windows editor for R is Tinn-R. It can directly send code to an R interpreter and has text highlighting etc. In Linux Kate is a great option, this is the standard editor in KDE.
  • A R plugin for the Eclipse IDE is StatET for those who like to use a nice IDE. The HOWTO concerning the configuration and use of the StatET IDE can be found here