run R from osgeo4w as a grass-python script
On 02/24/2012 10:00 AM, Massimo Di Stefano wrote:
Hi All, I'm an linux user and i'm bring to develop a series of python scripts for grass where i'm using rpy2 to call R and require the R packages spgrass6 (rgdal sp and others). On Linux and osx all runs as aspected .. now i need to port the script on windows .. and i'm a bit disoriented. i'd like to use grass and python that comes with the osgeo4w installer. I installed R, but i don't know how to use it from inside a grass session. If I run GRASS he is not able to detect the installed R .. and also the osgeo4w python .. rpy2 is not able to detect the R installation. Do you have any link to a guide or hints on how to have all running in the same environment ? Many many thanks for any help! once i'll figure out the esiest way to do it, i'm thinking to update the grass wiki to add an 'how to' to easy run grass and R tighter trough a python grass script.
Massimo, Taking a guess, I think you need to edit the .bat file that launches GRASS to ensure that it does so with R in the %PATH%. I believe many people have gotten the QGIS ManageR plugin to work with OSGeo4w so maybe there are additional hints there. FYI, ryp2 is broken in the recent python 2.7 upgrade of osgeo4w for lack of a windows binary for rpy2 for said version of python. Thank, Alex