[GRASS-stats] GRASS GIS 7.0 (stable) and R integration issue

Jesse Whittington jesse.whittington2 at gmail.com
Fri Oct 7 08:04:24 PDT 2016


Hi Roger,

I successfully loaded rgrass7 both with and without extensions
installed in grass.  I was then able to run a suite of grass commands
from R.  Thank-you for the fix!

I started R started from an existing grass project.
> Grass 7.0.4 (winGrass stand alone binary, WinGRASS-7.0.4-1-Setup-x86_64.exe)
> R version 3.3.1 (2016-06-21)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 7 x64 (build 7601) Service Pack 1

Jesse Whittington
Wildlife Ecologist
Banff National Park


On Thu, Oct 6, 2016 at 5:03 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
> I've put a Windows binary and source of rgrass7_0.1-9 on:
>
> http://spatial.nhh.no/R/rgrass7/
>
> which I believe resolves the issue. Please test and report back (on list,
> subscribe first, then reply or post). Please also check with addons present
> to be sure that the fix works both with and without addons.
>
> Roger
>
>
> On Thu, 6 Oct 2016, Roger Bivand wrote:
>
>> Hi,
>>
>> Thanks for helping resolve this.
>>
>> I have 3 addons seen in Settings -> Addon extensions -> Manage ...
>>
>> I reinstalled them, so for example .../bin/r.flip.exe has current time. In
>> R GUI:
>>
>>>  parseGRASS("r.flip")
>>
>> Command: r.flip
>> Extension: .exe
>> Description: Flips an image.
>> Keywords: Flips an image.
>> Parameters:
>>   name: input, type: string, required: yes, multiple: no
>>   keydesc: name, keydesc_count: 1
>> [Name of input raster map]
>>   name: output, type: string, required: yes, multiple: no
>>   keydesc: name, keydesc_count: 1
>> [Name for output raster map]
>> Flags:
>>  name:  w [East-West flip] {FALSE}
>>  name:  b [Both N-S and E-W flip] {FALSE}
>>  name:  overwrite [Allow output files to overwrite existing files] {FALSE}
>>  name:  help [Print usage summary] {FALSE}
>>  name:  verbose [Verbose module output] {FALSE}
>>  name:  quiet [Quiet module output] {FALSE}
>>>
>>>
>>
>> and
>>
>>>  Sys.getenv("PATH")
>>
>> [1] "C:\\Program Files\\GRASS GIS
>> 7.0.4\\Python27\\lib\\site-packages\\numpy\\core;C:\\Program Files\\GRASS
>> GIS 7.0.4\\gui\\scripts;C:\\Program Files\\GRASS GIS 7.0.4\\lib;C:\\Program
>> Files\\GRASS GIS
>> 7.0.4\\bin;C:\\Users\\rsb\\AppData\\Roaming\\GRASS7\\addons\\bin;C:\\Program
>> Files\\GRASS GIS 7.0.4\\extrabin;C:\\Program Files\\GRASS GIS
>> 7.0.4\\bin;c:\\Rtools\\bin;C:\\WINDOWS\\SYSTEM32;C:\\WINDOWS;C:\\WINDOWS\\SYSTEM32\\WBEM;C:\\WINDOWS\\SYSTEM32\\WINDOWSPOWERSHELL\\V1.0\\;C:\\PROGRAM
>> FILES\\INTEL\\WIFI\\BIN\\;C:\\PROGRAM FILES\\COMMON
>> FILES\\INTEL\\WIRELESSCOMMON\\;C:\\PROGRAM
>> FILES\\MATLAB\\R2011B\\BIN;;C:\\PROGRAM FILES
>> (X86)\\INTEL\\SERVICES\\IPT\\;C:\\PROGRAM FILES (X86)\\LENOVO\\ACCESS
>> CONNECTIONS\\;C:\\Program Files\\ThinkPad\\Bluetooth Software\\;C:\\Program
>> Files\\ThinkPad\\Bluetooth
>> Software\\syswow64;C:\\Rtools\\bin;C:\\Rtools\\gcc-4.6.3\\bin;C:\\Program
>> Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common
>> Files\\Intel\\WirelessCommon\\;C:\\Program Files\\RStudio\\bin;C:\\Program
>> Files\\R\\R-3.3.1\\bin\\x64"
>>>
>>>
>>
>> and directly:
>>
>>>  Sys.getenv("GRASS_ADDON_BASE")
>>
>> [1] "C:\\Users\\rsb\\AppData\\Roaming\\GRASS7\\addons"
>>>
>>>
>>
>> If I remove this folder, the:
>>
>>>  library(rgrass7)
>>
>> Loading required package: sp
>> Loading required package: XML
>> Error : .onAttach failed in attachNamespace() for 'rgrass7', details:
>>   call: if (class(t0) != "try-error" && is.character(t0) && nchar(t0) >
>>   error: missing value where TRUE/FALSE needed
>> Error: package or namespace load failed for ‘rgrass7’
>>>
>>>
>>
>> error becomes replicable. I'll report back when I've fixed it; the
>> workaround is to install any extension before starting R in GRASS.
>>
>> Roger
>>
>> On Tue, 4 Oct 2016, Helmut Kudrnovsky wrote:
>>
>>>  [also here: you have to be subscribed to be able to post on this ML ]
>>>
>>>
>>>  andy-1 at ukr.net wrote
>>> >  Dear ALL
>>> > >  I installed new GRASS GIS 7.0 (stable) and R (last versions + all >
>>> > > packages
>>> >  were updated). Then started R (also tried Rstudio) from GRASS  as it
>>> > is >  recommended here:
>>> > >  https://grasswiki.osgeo.org/wiki/R_statistics/rgrass7
>>> > >  R started, but when I tried to load libraries I got the following
>>> > > error
>>> >  and nothing works:
>>> > >  -------------
>>> > >  library(rgrass7)
>>> >  Loading required package: sp
>>> >  Loading required package: XML
>>> >  Error : .onAttach failed in attachNamespace() for 'rgrass7',
>>> >  details:
>>> >  call: if (class(t0) != "try-error" && is.character(t0) && nchar(t0) >
>>> >  error: missing value where TRUE/FALSE needed
>>> >  Error: package or namespace load failed for ‘rgrass7’
>>> > >  library(rgdal)
>>> >  rgdal: version: 1.1-10, (SVN revision 622)
>>> >  Geospatial Data Abstraction Library extensions to R successfully
>>> > loaded
>>> >  Loaded GDAL runtime: GDAL 2.0.1, released 2015/09/15
>>> >  Path to GDAL shared files:
>>> > C:/Users/Andriy/R/win-library/3.3/rgdal/gdal
>>> >  Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION:
>>> > 492]
>>> >  Path to PROJ.4 shared files: >
>>> > C:/Users/Andriy/R/win-library/3.3/rgdal/proj
>>> >  Linking to sp version: 1.2-3
>>> > >  G <- gmeta()
>>> >  Error: could not find function "gmeta"
>>> >  -----------
>>> > >  However if I just start R alone (not from GRASS) the packages are
>>> > > loaded
>>> >  normally  without errors (of course if I start R not from Grass I
>>> > can't
>>> >  use Grass data).
>>> > >  I tried older versions: Grass 6.4.2 works with R fine, but not
>>> > > GRASS 7.
>>> >  Tried on 3 different PCs. Same problem.
>>> > >  Could you please help to fix it?
>>> > > >  Thank you.
>>> >  Andrew
>>>
>>>  after starting R in winGRASS and before library("rgrass7") , could you
>>> do:
>>>  sessionInfo()
>>>  have you installed any GRASS addons? if yes, which one?
>>>  the addons are installed in C:\Users\yourusername\AppData\Roaming\GRASS7
>>>
>>>  if you have installed some GRASS addons, could you delete the addons
>>>  folder
>>>  in the C:\Users\yourusername\AppData\Roaming\GRASS7
>>>
>>>  then restart winGRASS (without any addons installed) and R and try to do
>>>  library("rgrass7") again and report the results.
>>>
>>>
>>>  -----
>>>  best regards
>>>  Helmut
>>>  --
>>>  View this message in context:
>>>
>>> http://osgeo-org.1560.x6.nabble.com/GRASS-GIS-7-0-stable-and-R-integration-issue-tp5281770p5289300.html
>>>  Sent from the Grass - Stats mailing list archive at Nabble.com.
>>>  _______________________________________________
>>>  grass-stats mailing list
>>>  grass-stats at lists.osgeo.org
>>>  http://lists.osgeo.org/mailman/listinfo/grass-stats
>>
>>
>>
>
> --
> Roger Bivand
> Department of Economics, Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; fax +47 55 95 91 00
> e-mail: Roger.Bivand at nhh.no
> http://orcid.org/0000-0003-2392-6140
> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
> http://depsy.org/person/434412


More information about the grass-stats mailing list