nlrx package

27 views
Skip to first unread message

Magda Chudzinska

unread,
Dec 2, 2020, 12:55:49 PM12/2/20
to netlog...@googlegroups.com
Dear NL users,

I am trying to use nlrx package to call my NetLogo model from R. Using the example code provided in the package description works on my computer.
I am now trying to use the package for my model. It is a big model which imports external data to setup, and also creates cvs files as outputs.
Has any of you tried to use the package to connect bigger models with R?
The error messages I receive are not very informative and below is an example (it is much longer, I just copied first few lines)
Exception in thread "main" Expected a literal value. at position 0 in 
	at org.nlogo.core.Fail$.exception(Fail.scala:27)
	at org.nlogo.core.Fail$.exception(Fail.scala:25)
	at org.nlogo.core.Fail$.exception(Fail.scala:23)

Best wishes,
Magda

Aaron Andre Brandes

unread,
Dec 11, 2020, 11:39:45 AM12/11/20
to Magda Chudzinska, netlog...@googlegroups.com

Hi Magda,

Thanks for your interest in NetLogo modeling.

 

I have not used the R extension for large data sets.

However the line ‘Expected a literal value. at position 0 in’ is more likely to reflect something unexpected in your data set, or a logic error in your code.

 

Therefore I think you need to do some debugging. If you can isolate the problem a bit, then you might be able to share your model and get help.

We might also be better able to help you if you can be more specific about what you are doing.

 

Strategically there are a number of things you can do.

For example you can run the same model on a reduced data set.

If that is successful then the result could be size related, or it could be specific to part of your data set.

If it fails, you now have a smaller example you can share with others.

 

Your error message may well be associated with an attempt to read data.

 

If the data is being read by R you can examine it using R debugging and plotting tools

If the data is being read by NetLogo, then you can use some output commands to identify where the code is changing

 

For example you can create a variable lines-read that is incremented by one for each line that is correctly read from the dataset. Create a monitor that will display that variable. If reading fails at some point, the monitor will show the correct line number. Link for info on creating a monitor

 

You might also use one of NetLogo’s output commands

 

An output command that will stop execution is user-message

 

If the commands to set up your model are time consuming, or if you stop in a state you may want to save for debugging, you may want to use some of the export commands.

 

I hope this is helpful, and let the list know if you have further questions.

Aaron

-- 

Aaron Brandes, Software Developer

Center for Connected Learning and Computer-Based Modeling

--
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/CAAwC%2Bf5DJ2m3rn9XWMQP7CDhJ3uNEv50GmT%3D8JNt1vG%3DPm7o%3Dg%40mail.gmail.com.

Michael Tamillow

unread,
Dec 11, 2020, 3:58:37 PM12/11/20
to Aaron Andre Brandes, Magda Chudzinska, netlog...@googlegroups.com
Yeah, I would second Aaron’s comment. You need to show what you are actually attempting to do if you want debugging help. The set of “things that could be causing this exception” is probably very large without more specific information. 

Sent from my iPhone

On Dec 11, 2020, at 10:39 AM, Aaron Andre Brandes <aaron....@northwestern.edu> wrote:



Magda Chudzinska

unread,
Dec 17, 2020, 6:03:19 AM12/17/20
to Michael Tamillow, Aaron Andre Brandes, netlog...@googlegroups.com
Thank you guys for the advice, I will have a look at it, try to implement it and will let you know about the outcome (if you are interested)

Magda
Reply all
Reply to author
Forward
0 new messages