Learn R Programming

RNetLogo (version 0.9.2)

NLDfToList: Transforms a data.frame into a NetLogo-List or multiple NetLogo-List (one for each column of the data.frame).

Description

NLDfToList function is used to push the values of a data.frame in NetLogo-Lists. The column names of the data.frame are used as names for the NetLogo-Lists (but the NetLogo-List must already exist in the current NetLogo model).

Usage

NLDfToList(in.data.frame, nl.obj=NULL)

Arguments

in.data.frame
The data.frame which should be used to fill the NetLogo-Lists (with the names of the columns of this data.frame) with the corresponding values of the column.
nl.obj
(optional) A variable holding a reference to a NetLogo instance created with NLStart.

Value

  • No return value.

Details

Remember: There have to be NetLogo-Lists in the NetLogo model with the names of the columns of the submitted data.frame.

See Also

NLDoCommand, NLDoCommandWhile, NLReport

Examples

Run this code
NLStart("C:/Program Files/NetLogo 4.1.3")
df1 <- data.frame(x=c(1,2,3,4),y=c(1,2,3,4))
# the current NetLogo model must have lists with the names 'x' and 'y'
NLDfToList(df1)

Run the code above in your browser using DataLab