Skip to content
Prev 18028 / 29559 Next

warnings and errors from grass to R via spgrass6

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. 

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---