[GRASS-stats] [GRASS-web] ERROR: Running R studio script from GRASS GIS console.

Roger Bivand Roger.Bivand at nhh.no
Fri Aug 9 00:53:25 PDT 2019


Replying only on grass-stat as not subscribed to grass-web.

Thanks, Vero, well spotted. The error message (image in Pratik's post - 
please never post pictures, only ever plain text) indicates that the 
current release is being used, but that the message at:

https://lists.osgeo.org/pipermail/grass-stats/2019-August/001802.html

has not been read. It is also wrong to say that anything is an RStudio 
script; RStudio is !NOT! R, but rather a for-profit corporation 
(well-meaningly) distorting the idea of what R can do.

As you noted, Pratik has not read the help page for the called function 
either, as SG= is an R SpatialGrid object used to instantiate a new 
temporary location, but the location is being given here. The function 
would fail anyway because the the next call to sp::bbox(SG) would not find 
a method for a character string. I'll improve the error message in the 
next release (87eaa6c on https://github.com/rsbivand/rgrass7).

As author and maintainer of rgrass7, I strongly advise against using 
initGRASS() on an existing location - the function was written to permit 
the use of throwaway, one-time locations for using GRASS modules on user 
data not in GRASS.

If you have a location, start GRASS first, then R within GRASS to be sure 
to get consistency in your use of the GRASS environment and location. If 
RStudio gets in the way, that is RStudio's problem; on Linux, RStudio 
works correctly started in the terminal in which GRASS was started (can be 
run with $ rstudio & to get the prompt back), and in the Layer Manager 
Console (I have not found out how to put rstudio in the background in the 
Layer Manager Console, which remains blocked until rstudio exits).

I also think here that Pratik does not have a valid location, as 
<gisDbase>/<location>/PERMANENT/DEFAULT_WIND could not have existed for 
the code with the error message to be reached. Had GRASS been run on the 
location at all? Were the data where they should have been? Using 
PERMANENT as the user mapset is also bad practice.

Hope this helps,

Roger

On Fri, 9 Aug 2019, Veronica Andreo wrote:

> Hi,
>
> If you just updated rgrass7, I'd suggest you to subscribe and write to
> grass-stats list. The error sounds like something in the new version.
>
> In any case, I would try with use_sp() before using initGRASS(), and also
> try without the SG parameter, I believe it's not mandatory anyway.
>
> Hth,
> Vero
>
>
> El jue., 8 ago. 2019 12:40, pratik deb <deb.pratik26 at gmail.com> escribió:
>
>> Dear Sir,
>> I am Pratik Deb. I have download the "nc_spm_08_grass7" data from GRASS
>> GIS site and want to run R studio script from GRASS GIS console, and to
>> run GRASS GIS from RStudio. The initGRASS cmd in R Studio is not working
>> and showing the following error.
>>
>> You are requested to give your valuable suggesions in this issue.
>>
>> I will be highly greatful to you, if you provide a tutorial regarding
>> setup and simulation of TOP Hydrological Model through GRASS GIS interface.
>>
>> *With kind regard,*
>>
>>
>>
>>
>> एर. प्रतीक देब, म. टेक  / Er. Pratik Deb, M.Tech
>>
>> पर्यावरण भूविज्ञान और प्राकृतिक संसाधन प्रभाग / Environmental Geology and
>> Natural Resources Division
>>
>> गढ़वाल क्षेत्रीय केंद्र / Garhwal Regional Centre
>>
>> गोविन्द बल्लभ पंत राष्ट्रीय हिमालयी पर्यावरण एवं सतत विकास संस्थान / G.B.
>> Pant National Institute of Himalayan Environment & Sustainable Development
>>
>> पर्यावरण, वन और जलवायु परिवर्तन मंत्रालय / Ministry of Environment,
>> Forest & Climate Change
>>
>> श्रीनगर-गढ़वाल / Srinagar-Garhwal
>>
>> पौड़ी गढ़वाल / Pauri Garhwal
>>
>> उत्तराखंड / Uttarakhand
>>
>> भारत २४६१७४ / INDIA 246174
>>
>>
>>
>> दूरभाष / Phone: +91-9411743190 / +91-9734130600
>>
>> ईमेल  / Email: deb.pratik26 at gmail.com ; pratik.iitkgp at outlook.com
>>
>>
>> https://www.researchgate.net/profile/Pratik_Deb3
>>
>> https://orcid.org/0000-0002-6091-8724
>>
>> https://scholar.google.co.in/citations?hl=en&user=n2YBkXoAAAAJ
>>
>> <https://orcid.org/0000-0002-6091-8724>
>> _______________________________________________
>> grass-web mailing list
>> grass-web at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/grass-web
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand at nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en


More information about the grass-stats mailing list