Home > debian, postgis, postgres > Installing R on Windows and Debian

Installing R on Windows and Debian

November 16th, 2007 rupert

‘R’ is a statistical package. For an overview, please go to www.r-project.org
My intention was to remove the point outliers from a given set of point geometries.

I just recently installed R both on my Windows XP and Debian. Regina’s www.bostongis.com is an excellent tutorial in getting involved with R. I do suggest you head first to PLR Part 1: Up and Running with PL/R (PLR) in PostgreSQL: An almost Idiot’s Guide to get you started.

The install instructions for Windows works flawlessly. I have to hold back to R-2.5 though as I plan to use RPy (Python for R), see details below. To install ‘R’ in Debian, there’s a couple of settings that we need to take care of…

1. Install r-base
sudo apt-get install r-base

2. Install plr on postgres
sudo apt-get install postgresql-8.2-plr

3. Using R in a database
psql -d beijing -U lbs -h 127.0.0.1 < /usr/share/postgresql/8.2/plr.sql

4. Set the R_HOME environment variable
/etc/postgresql/8.2/main/environment
R_HOME='/usr/lib/R'

5. Restart Debian.

RPy, R for Python, is another alternative to use R in Python. I installed it both in Windows and Debian. Note that I reverted to R-2.5 on Windows to be compatible with RPy. For Debian, Im currently using R-2.6.

For the Windows Binary Installation,

1. Read the RPy Main Site

2. Install prerequisites:

- NumPy
- Win32 Extensions Download

3. Afterwards, install the main package, RPy Download

In Debian, its a straight forward…sudo apt-get install python-rpy

Categories: debian, postgis, postgres Tags: ,
Comments are closed.