[GRASS-stats] Error using GRASS from R

Roger Bivand Roger.Bivand at nhh.no
Thu Jul 21 07:38:50 EDT 2011


On Thu, 21 Jul 2011, Tim Besser wrote:

> Ok, now I tried it in the GRASS terminal. Used parseGRASS("r.reclass") and it 
> showed me the GRASS output as desired. With parseGRASS("r.patch") I had the 
> same error as before: "r.patch not found"
>
> I am a programming beginner and I am very happy that I managed writing a R 
> script which does everything I need step by step. I begin to understand that 
> doing this from R to GRASS is not too straight-forward. But I got quiet 
> familiar in R coding.
>
> When I start R from GRASS (I managed) how do I use the GRASS-commands then. 
> No initGRASS and no execGRASS, but what else?

You do not need initGRASS(), because all the environment variables GRASS 
needs are already provided. Use execGRASS() without initGRASS(). It is 
more worrying that r.patch is still not seen.

Roger

>
> And the last thing. The file extensions in Win you meant? Enabled them but 
> still the same error.
>
> Cheers,
>
> Tim
>
> Am 20.07.2011 20:32, schrieb Roger Bivand:
>> On Wed, 20 Jul 2011, Tim Besser wrote:
>> 
>>> Dear GRASS-community,
>>> 
>>> I have a very strange problem. I wrote a script in R (2.10.1) for the 
>>> preparation of my datasets which works fine on my laptop (winxp). I do not 
>>> start my R session from GRASS but use GRASS through the initGRASS and 
>>> execGRASS commands. I use the "spgrass6" package and GRASS 6.4.1. As the 
>>> script would run for days on my old laptop I now got a remote desktop 
>>> connection to a much faster computer at the university (win7). However, 
>>> while cmds like r.reclass or r.in.gdal (execGRASS) work on that computer 
>>> the r.patch (execGRASS) cmd produces following error:
>> 
>> Do not start R in GRASS using initGRASS when you are using an exiting 
>> location - I will most likely remove this possibility at the next release 
>> as it confuses users. Start in the usual way by starting GRASS in a 
>> terminal - text interface - and then start R from the GRASS prompt, or use 
>> the MSYS console within GRASS (the second of the two GRASS icons).
>> 
>> In your case, I cannot even see why you need R - why not just write a shell 
>> script, or in GRASS 7 a Python script?
>> 
>> Can you run parseGRASS("r.patch")? What does parseGRASS("r.reclass") 
>> return? For some reason, your remote Windows GRASS installation appears to 
>> be treating programs differently. Make sure that you expose the extensions 
>> when you observe the names of files under Windows - by default it displays 
>> names without extensions, and a missing extension may be the problem. There 
>> may also be an issue in the way that Win7 handles DOS-style path formats - 
>> I have no access to such an OS, so have no idea. I cannot see any 
>> differences with the Windows native GRASS 6.4.1 on XP.
>> 
>> Createprocess is what starts a new process, and may possibly have 
>> permissions issues. You'd need to run the same thing locally on an 
>> identical Win7 system with the same permissions to check. Using a shell 
>> script would avoid this, I believe.
>> 
>> Roger
>> 
>>> 
>>> execGRASS("r.patch", flags=c("z"), 
>>> parameters=list(input="mangroves_1989_138_044_LR_recl,mangroves_1989_138_045_UL_recl,mangroves_1989_138_045_UR_recl", 
>>> output="testomat"), intern=T)
>>> 
>>> Error in system(cmd0, intern = TRUE) :
>>>  Createprocess konnte 'C:\GRASS6~1.1\bin\RPATCH~1.EXE 
>>> --interface-description' nicht ausführen
>>> Fehler in parseGRASS(cmd) : r.patch not found
>>> 
>>> I checked the GRASS directory and it is set right in the initGRASS 
>>> command.
>>> 
>>> I hope you can help me with one. I have no clue what to do!
>>> 
>>> Thanks in advance,
>>> 
>>> Tim
>>> 
>>> _______________________________________________
>>> grass-stats mailing list
>>> grass-stats at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/grass-stats
>>> 
>> 
>
>
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the grass-stats mailing list