[GRASS-dev] adding lib_arraystats

Dylan Beaudette dylan.beaudette at gmail.com
Tue Feb 12 12:42:39 EST 2008


On Feb 11, 2008 7:30 PM, Hamish <hamish_b at yahoo.com> wrote:
> Dylan wrote:
> > However, an hour spent tinkering around with the R shared lib
> > examples left me mostly frustrated....
>
> From the everything looks like a nail dept:
> Does R offer SWIG bindings into the lib that we could use with python?
>
>
> Hamish
>
>

This project (http://rpy.sourceforge.net/) comes to mind. Not sure if
it is SWIG based... It looks like straight-up python:

import Rpy
...


I suppose that the only problem then is getting Rpy installed. On a
debian-like system you can install R and Rpy via aptitude. If you
build R from source, then I suppose you would have to build / install
Rpy in a similar manner.


Before giving up on the C-API to R, I think that there are a couple
more approaches, which might be simpler.

1. call R in batch mode. this would involve the use of temp files,
passing data and commands back and forth from GRASS to R-- with the
shell as mediator. This would only require a vanilla install of R.

2. build R as a shared lib, and use the "embedded" interface to R
commands. There are a couple examples in the source tree for this.


However-- this is starting to get into the realm of feature bloat...
As neat as it would be to have R routines which could work directly on
GRASS data structures, it might be overkill considering the possible
amount of work. I'll keep checking around and post back other ideas.

On the other hand-- R has so many great plotting / analysis routines,
it would be a shame to re-implement these in GRASS if they could be
easily "plugged-into" via some kind of share library / SWIG
interface.

Dylan


More information about the grass-dev mailing list