[R] Re: [STATSGRASS] Using GRASS/R interface with an xy location

Roger Bivand Roger.Bivand at nhh.no
Tue Feb 8 17:58:43 CET 2005


On Tue, 8 Feb 2005, Steven T.Stoddard wrote:

> I am using GRASS 5.7 and R 2.0 for OS X.  I have a simple xy location I 
> am doing some theoretical work with and would like to import maps into 
> R using the interface in order to do analyses.  Yet when I attempt to 
> do this, I get the following error:
> 
>  >G<-gmeta()
> Error in gmeta() : region for current mapset is invalid
> line 11: <top:        100>
> run "g.region"
> 
> I traced the problem to the compiled C program that is called from the 
> gmeta R function (i.e. > .C("gmeta") gives me the same error). I 
> haven't been able to locate the source code on my volume.
> 
> If I use gmeta(interp = TRUE) there is no problem, until I want to 
> actually try and import data from my locations.

The current fix for 5.7 and 6.0.0beta is to use interp=TRUE. The cause of 
the problem seems to be the use of the 3D WINDOW, which the older code in 
the R-GRASS interface doesn't yet honour. I'm not at all sure what will 
happen if your x,y locations are sites; the interface knows about 
old-style sites, not vector sites. You may be obliged to use system("") to 
issue GRASS 5.7 commands to write out an ASCII file to read into R with 
read.table().

Roger


> 
> Any help is appreciated.
> 
> Steve
> 
> ---
> Steven T. Stoddard
> 
> Program in Ecology, Evolution and Conservation Biology
> University of Illinois at Urbana-Champaign
> 
> (217) 333-2235
> 302 Shelford Vivarium
> 606 E. Healy Ave
> Champaign, IL  61820
> http://www.life.uiuc.edu/~sstoddar
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no




More information about the R-help mailing list