[GRASS-dev] Plan to build Package to use GRASS from R

Rainer M Krug r.m.krug at gmail.com
Wed Feb 27 14:23:00 EST 2008


On 27/02/2008, Glynn Clements <glynn at gclements.plus.com> wrote:
>
>
> Rainer M Krug wrote:
>
> > Sorry for crossposting, but I think this can be of interest for GRASS
> and R
> > users.
> >
> > I am planning to write a package to make the use of GRASS from R easier.
> The
> > idea is to wrap the system call to execute the GRASS command into an R
> > command of the same name.
> > e.g:
> > r.to.vect <- function(..., intern=TRUE, ignore.stderr=FALSE)
> >   {
> >     comm <- paste( "r.to.vect ", ..., sep="" )
> >     print(comm)
> >     system( comm, intern=intern, ignore.stderr=ignore.stderr )
> >   }
> >
> > My questions are:
> >
> > 1) Is this a good way of doing it, or is giving a named list to the
> function
> > more usefull?
>
>
> If R provides a way to pass individual arguments (argc/argv), use that
> instead of contructing a shell command as a string. Otherwise, you are
> likely to run into problems with shell metacharacters in argument
> values.


I will lookm at that - because I already had the problems. And I would like
to avoid them in the future!

> 2) Is there a way to obtain easily all commands from GRASS and the
> > parameters possible and required?
>
> You can obtain a list of commands by enumerating the $GISBASE/bin and
> $GISBASE/scripts directories. Nearly all commands support the
> --interface-description switch, which outputs details of all of the
> options in XML. There are several other switches which output the same


That looks very good. I'll look into that.

information in different formats; see the g.parser manpage for
> details.


Thanks for your toips ' I will  look at them and come back if I don't
understand them.

Thanks

Rainer


--
> Glynn Clements <glynn at gclements.plus.com>
>



-- 

-- 
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)

Plant Conservation Unit Department of Botany
University of Cape Town
Rondebosch 7701
South Africa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20080227/6ad9ee1a/attachment-0001.html


More information about the grass-dev mailing list