[GRASS-stats] R library not found in batch mode

ghislain v. quenual at gmail.com
Tue Mar 2 14:03:21 EST 2010


Dear GRASS and R users,

I try to use R within GRASS in batch mode:

- I have a first file Script.sh which includes:

#!/bin/sh
export GRASS_BATCH_JOB=/home/ghislain/my_grassjob.sh
grass64 /home/ghislain/grassdata/Geo/PERMANENT

- A second file my_grassjob.sh which includes:

#!/bin/sh
R CMD BATCH /home/ghislain/ScriptRwithinGRASS.r

- And a third file (the R script ScriptRwithinGRASS.r) containing:

library(GRASS)
library(spgrass6)
library(sp)
system("g.region -p")
...
... other commands

When, I launch sh Script.sh, it opens GRASS and R correctly but the
libraries cannot be found:

> library(GRASS)
Erreur dans library(GRASS) : aucun package nommé 'GRASS' n'est trouvé
Exécution arrêtée

Whereas when I use in a terminal the following commands:

grass64 /home/ghislain/grassdata/Geo/PERMANENT
R
library(GRASS)

the GRASS library is found.

Does someone have an explication to overcome this problem.

Thanks for your help.

Ghislain


More information about the grass-stats mailing list