[R-sig-Geo] [GRASS-stats] R packages and GRASS

Agustin Lobo alobolistas at gmail.com
Thu Nov 5 19:18:44 CET 2009


There is no menu for R in grass. As I've said, in order to use grass from R 
(through R package spgrass6), the best option is  to start R from the grass 
console. Perhaps the problem is that you don't know what the grass console is? 
Then you must get a bit familiar with grass first.

Here (http://grass.itc.it/statsgrass/grass6_r_install.html) it's also pretty clear:

"Usage
You need to start R in a GRASS terminal to make best use of the interface."

Agus

Felipe Carrillo wrote:
> I looked in the help files and I can't find a way to open R from any of the menu options. I wanted to use GRASS from R but it's ok to open R from GRASS for now so I can get familiar with the program but I eventually want to automate GRASS from R. I tried the commands below in GRASS and they seem to work ok, but I don't know how to interact with R yet.
> # set region:
>  g.region rast=elevation.dem
>  
>  # extract some random points from an elevation dataset
>  v.random out=rs n=300
>  
>  # create attribute table:
>  v.db.addtable map=rs columns="elev double"
>  
>  # extract raster data at points
>  v.what.rast vect=rs rast=elevation.dem column=elev
>  
>  # simple display:
>  d.rast elevation.dem
>  d.vect rs size=4
> 
> 
> --- On Thu, 11/5/09, Agustin Lobo <alobolistas at gmail.com> wrote:
> 
>> From: Agustin Lobo <alobolistas at gmail.com>
>> Subject: Re: [GRASS-stats] R packages and GRASS
>> To: "Felipe Carrillo" <mazatlanmexico at yahoo.com>
>> Date: Thursday, November 5, 2009, 8:58 AM
>> (Disregard the attachment, it was
>> just my signature,
>> I was not aware of sending it, just changed the settings
>> of this account)
>>
>> Are you starting R from within the grass console?
>> Agus
>>
>> Felipe Carrillo wrote:
>>> Agustin:
>>> I get the message below while trying to execute from
>> R
>>>> system("g.region rast=elevation.dem") 
>>> Warning message:
>>> In system("g.region rast=elevation.dem") : g.region
>> not found
>>> On the same note, Would you mind sending me the
>> attachment on a different format? This is a government
>> computer and I don't have outlook to open it. Just copy and
>> paste onto notepad or word if you don't mind. Thanks
>>>
>>> Felipe D. Carrillo  Supervisory Fishery
>> Biologist  Department of the Interior  US Fish
>> & Wildlife Service  California, USA
>>>
>>> --- On Thu, 11/5/09, Agustin Lobo <alobolistas at gmail.com>
>> wrote:
>>>> From: Agustin Lobo <alobolistas at gmail.com>
>>>> Subject: Re: [GRASS-stats] R packages and GRASS
>>>> To: "Felipe Carrillo" <mazatlanmexico at yahoo.com>
>>>> Cc: "GRASS STATS" <grass-stats at lists.osgeo.org>
>>>> Date: Thursday, November 5, 2009, 8:04 AM
>>>> which error? we don't see it. Note
>>>> you must start R from within
>>>> the grass console. Actually it's better if, from
>> the grass
>>>> console,
>>>> you launch xterm & and can start R from the
>> new
>>>> terminal.
>>>>
>>>> Agus
>>>>
>>>> Felipe Carrillo wrote:
>>>>> Hi all:
>>>>> I'm brand new to GRASS and this list and just
>> wanted
>>>> to see if someone could point out to what I need
>> to
>>>> synchronize R and GRASS. I already downloaded
>> GRASS 6.3,
>>>> spgrass6 and dependencies and at my first attempt
>> something
>>>> is happening but I can't quite see a way to import
>> data into
>>>> R or run commands from R. I ran into the code
>> below
>>>> yesterday but I can't figure out how to run it
>> from R. I
>>>> tried: system("g.region rast=elevation.dem") but I
>> get an
>>>> error message. Thanks
>>>>> # set region:
>>>>> g.region rast=elevation.dem
>>>>>
>>>>> # extract some random points from an
>> elevation
>>>> dataset
>>>>> v.random out=rs n=300
>>>>>
>>>>> # create attribute table:
>>>>> v.db.addtable map=rs columns="elev double"
>>>>>
>>>>> # extract raster data at points
>>>>> v.what.rast vect=rs rast=elevation.dem
>> column=elev
>>>>> # simple display:
>>>>> d.rast elevation.dem
>>>>> d.vect rs size=4
>>>>>
>>>>> # start R
>>>>> R
>>>>>
>>>>>
>>>>> Felipe D. Carrillo  Supervisory Fishery
>>>> Biologist  Department of the Interior 
>> US Fish
>>>> & Wildlife Service  California, USA
>>>>>     
>>>>    
>> _______________________________________________
>>>>> grass-stats mailing list
>>>>> grass-stats at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/grass-stats
>>>>>
>>>>>     
>>>
>>>        
> 
> 
>       
>



More information about the R-sig-Geo mailing list