Error in R-Extension

58 views
Skip to first unread message

Ortnero

unread,
May 5, 2021, 9:01:05 AM5/5/21
to netlogo-users
Hi,
I would like to use the r extension in Netlogo for homerange calculation. I was able to connect Netlogo and R (working with Netlogo 6.1.1). I wanted to use the adehabitatHR package. Now i have the problem, that Netlogo seems not to be able to load the ade4 package when loading adehabitatHR. So I seperately installed ade4 - but I get the same error:

Extension exception: Error in R-Extension: Error in Eval:
org.nlogo.api.ExtensionException: Error : Paket 'ade4' konnte nicht geladen werden

Do you have any ideas what could be the problem and how to solve it?
(R version: 4.0.5)

regards
Liv

Tiago Mendes

unread,
May 6, 2021, 4:46:15 AM5/6/21
to Ortnero, netlogo-users

Hi Liv,

 

Are you using Linux? I had a similar problem when using the R-Extension in Linux (the same does not happen in Windows). I think it is related to a compatibility problem between R-Extension and the latest versions of R. I was able to solve the problem by using an older version of R (R 3.4.4). I hope this solves your problem.

 

Does anyone know if this extension continues to be maintained and updated?

 

Regards,

Tiago Mendes

--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/d0ce5312-ba15-4017-b073-aef51c775f83n%40googlegroups.com.

 

Ortnero

unread,
May 6, 2021, 12:26:02 PM5/6/21
to netlogo-users
Hi Tiago,
thank you very much for your reply. I am working with Windows - so unfortunately this seems not to be the problem in this case. Downgrading the R version seems also not to be an option - because the packages I want to use are not available for older versions of R.  It would really be good to know if the extension is still mentained - I am into movement ecology and want to simulate homerange changes with variable landscapes. So I need a working R extension. Otherwise would have to switch platform, what I really don´t want.
regards
Liv

Aaron Andre Brandes

unread,
May 6, 2021, 9:36:14 PM5/6/21
to Ortnero, netlogo-users, Tiago Mendes

Hi,

The NetLogo Development team intends to keep the R-extension working.

I did a successful basic test on Windows, MacOS and Ubuntu with R 4.0.3 before we released NetLogo 6.2.0.

 

I tried a modified version of the “Homerange example of R-extension”

;; Homerange example of R-extension

;;

;;

;; by Jan C. Thiele

;; University of Goettingen, Germany

;; Department Ecoinformatics, Biometrics and Forest Growth

;; Buesgenweg 4

;; 37077 Goettingen

;; Germany

;;

;; Contact: jth...@gwdg.de

;;

;; Copyright: 2011, J.C. Thiele

 

In MacOS I was able to

 

  r:eval "library(ade4)"

  r:eval "library(adehabitatHR)"

  r:eval "library(adehabitatHS)"

  r:eval "library(adehabitatLT)"

  r:eval "library(adehabitatMA)"

 

However at the line

  r:eval "homerange <- mcp(xy, id)"

 

I got the following error.

 

 

Extension exception: Error in R-Extension: Error in Eval:

org.nlogo.api.ExtensionException: Error in mcp(xy, id) : xy should be of class SpatialPoints

 

error while observer running R:EVAL

  called by procedure CALC-HOMERANGE

  called by Button 'calc-homerange'

 

It appears that the interface to mpc may have changed.

Do either of you have an example of a program that works in R 4.0 but doesn’t work when translated in NetLogo with the R Extension?

Thanks,

Aaron

 

-- 

Aaron Brandes, Software Developer

Center for Connected Learning and Computer-Based Modeling

Ortnero

unread,
May 7, 2021, 4:16:09 AM5/7/21
to netlogo-users
Hi Aaron,
thank you confirming, that the r extension is kept working. It is possible for you to use the adehabitat package with R version 4.0.3? I got the error message that this packes works only for version 4.0.5 when trying to install it in R 4.0.3. Do you have any ideas why Netolog cant load  the ade4 package in my case? Is there something I could try to make it work?

regards
Olivia

Tiago Mendes

unread,
May 7, 2021, 5:03:55 AM5/7/21
to Aaron Andre Brandes, Ortnero, netlogo-users

Hi Aaron,

 

My problem is when trying to load some pckages, like "adegenet" in newer versions of R, which can't load the "units" dependency, with the following error:

 

library(units)
Error: package or namespace load failed for ‘units’:
.onLoad failed in loadNamespace() for 'units', details:
call: udunits_init(file.path(.get_ud_xml_dir(), "udunits2.xml"))
error: Error in function udunits_init: Error parsing unit specification

 

I have the this same error with NetLogo versions 6.1.1 and 6.2.0. However, this error does not occur if you use an older version of R, such as R 3.4.4. This only happens when I run the model on Linux platforms, on Windows it runs perfectly.

 

Let me know if you need more information.

 

 

Thanks ,

Tiago Mendes

Aaron Andre Brandes

unread,
May 7, 2021, 9:14:27 AM5/7/21
to Tiago Mendes, Ortnero, netlogo-users

Hi,

It would be helpful if you could both create two simple test files that demonstrate the issues you are encountering.

  • An R program that can be run at the command line, or inside R
  • A NetLogo Model that runs equivalent code.

 

Please run the NetLogo programs using NetLogo 6.2.0, which is our current version. I doubt there are any differences from 6.1.1 that are causing the problem, and we update only the most recent NetLogo and its extensions. Please send us your System Info, which is available by using the NetLogo->About NetLogo menu item (Could also be under Help->About NetLogo) and clicking on the System Tab.

 

Please specify which version of R it doesn’t work on (e.g. 4.0.3) , as well as a version on which it works (for example R 3.4.4. ).   You can capture information using the sessionInfo() command in R.

 

If a program works on 4.0.3 and not 4.0.5 this may be more of an R issue.

 

Please also look over the documentation of the R packages involved, or on R forums to find out if there are known issues with these packages.

 

That will all help us debug the problem at the NetLogo end.

Reply all
Reply to author
Forward
0 new messages