Download and installation
Statistical back-end
Setting up Rserve and running it
To be able to use R as a back-end for the WPS, it is also necessary to install Rserve. The wps connects to R using Rserve, which is available from CRAN. First we need to install Rserve. We'll do this from CRAN.- Define a library (e.g. Rlibs) where the R libraries are stored, and start R with R_LIBS=~/Rlibs R
- On the R prompt, install Rserve by > install.packages("Rserve")
- The intamap package can be installed similarly, and automatically loaded by:
> install.packages("intamap")
> library(intamap)
> timeModels <- generateTimeModels()
> .First <- function() {
library(intamap)
}
> q("yes") This creates a file called .Rdata which will be loaded every time R/Rserve is started from the same directory. If the installation is done on a Linux-server, it is recommended to install the psgp-package instead of the intamap-package above. The psgp-package will automatically also install the intamap-package. The line > timeModels <- generateTimeModels() is necessary for generating time models that are consistent with server where Rserve is running. These time models are used for estimating the prediction time for different estimation methods. There are default time models included in the intamap package, but these are only valid for the computer on which they were calculated. Generation of time models can be rather time consuming (hours - days), depending on the parameter nSam, which defines the number of examples for each combination of number of observation locations, prediction locations and prediction type. A larger number (e.g. nSam = 10) will reduce some of the randomness in the estimation of these time models. - Rserve can now, from the same directory where it was started earlier, be started in daemon mode by
R_LIBS=~/Rlibs nohup R CMD Rserve --no-save &
This will append the output from R to the logfile nohup.out. It is recommended to remove the old logfile before restarting Rserve. After starting Rserve, this file should look something like:
R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. [Previously saved workspace restored] Loading required package: sp Loading required package: gstat Loading required package: rgdal Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runtime: GDAL 1.4.0.0, released 2007/01/02 GDAL_DATA: /home/rserve/Rlibs/rgdal/gdal Loaded PROJ.4 runtime: Rel. 4.4.9, 29 Oct 2004 PROJ_LIB: /home/rserve/Rlibs/rgdal/proj Loading required package: akima Loading required package: automap Rserv started in daemon mode.
Maintainance
If you need to stop Rserve, e.g. because you need it to load a newer version of some package, kill it first with killall -s9 RserveWhen R runs on a different server from the wps server
When R runs on a different server from the wps server you need to configure Rserve such that it accepts connections from the machine on which the wps runs. See the Rserve documentation how to do this, under section configuration.