[R-sig-Geo] warnings and errors from grass to R via spgrass6

Roger Bivand Roger.Bivand at nhh.no
Tue Apr 16 18:11:18 CEST 2013


On Tue, 16 Apr 2013, Rainer M. Krug wrote:

> Hi
>
> I am using spgrass6 with grass 7 and can report that it works so far
> without problems.
>
> Nevertheless, I have one question, which I already had about grass 6.
>
> I am using execGRASS to execute grass commands as well as an own defined
> function r.mapcalc [1].
>
> Now as these are used in a simulation script, I would like to (actually
> need to know) when these functions fail.

Rainer:

Could you please create a simple test case with some built-in data set and 
initGRASS()? I see from ?system that some cases are addressed, but with 
intern=TRUE.

Roger

>
> Is there a way that errors and warnings in GRASS will be reflected as
> errors and warnings in R when tthe grass function is called via execGRASS?
>
> I am using Linux and R 3.0.0
>
> Thanks,
>
> Rainer
>
>
> Footnotes:
> [1] r.mapcalc is defined as follow:
> --8<---------------cut here---------------start------------->8---
> r.mapcalc <- function(
>    ...,
>    intern = TRUE,
>    ignore.stderr = !options("asmDebug")[[1]],
>    feedback = TRUE,
>    flags = NULL
>    ) {
>    comm <- paste( "r.mapcalc ", " \"", ..., "\" ", sep="" )
>    if (!is.null(flags)) {
>      flags <- paste0("--", flags, collapse=" ")
>    }
>    comm <- paste(comm, flags)
>    if (feedback) print(comm)
>    system( comm, intern=intern, ignore.stderr=ignore.stderr )
>  }
> --8<---------------cut here---------------end--------------->8---
>
>
>
>
>
>

-- 
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 R-sig-Geo mailing list