Hi 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? 2) Is there a way to obtain easily all commands from GRASS and the parameters possible and required? Any ideas and comments welcome, Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Plant Conservation Unit Department of Botany University of Cape Town Rondebosch 7701 South Africa [[alternative HTML version deleted]]
Rainer M Krug
2008-Feb-27 13:24 UTC
[R] [R-sig-Geo] Plan to build Package to use GRASS from R
On 27/02/2008, Virgilio Gomez-Rubio <v.gomezrubio@imperial.ac.uk> wrote:> > Hi, > > > > > if you are refering to spgrass6, yes, But if I want to execute > > commands in GRASS, I still have to use system(...) > > > OK. I just wanted to check... :) Not sure what ROger Bivand will think, > but maybe it would be better to add waht you develop to that package.Sounds like a perfect suggestion - otherwise everything could become to fragmented and difficult to use. Regards,> > > Virgilio > > >-- -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Plant Conservation Unit Department of Botany University of Cape Town Rondebosch 7701 South Africa [[alternative HTML version deleted]]
Roger Bivand
2008-Feb-28 07:29 UTC
[R] [R-sig-Geo] Plan to build Package to use GRASS from R
On Wed, 27 Feb 2008, Rainer M Krug wrote:> Hi > > Sorry for crossposting, but I think this can be of interest for GRASS and R > users.Yes, please avoid cross-posting - the discussion ends up on many different lists and threading can break down if the threading implementation in mail clients and archives doesn't like cross-posting. The only complete thread I have found is on Nabble at: http://www.nabble.com/Plan-to-build-Package-to-use-GRASS-from-R-tt15712877.html#a15712877 for the grass-dev list. In summary, the problems are mostly those of appropriately quoting shell commands through system() across platforms. Those interested should follow the discussion on grass-dev. The correct lists could be either here, or the grass-stats list; could Rainer post a summary to both (hopefully in-thread) on conclusion? Roger> > 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? > 2) Is there a way to obtain easily all commands from GRASS and the > parameters possible and required? > > Any ideas and comments welcome, > > Rainer > > >-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, 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