Displaying 1 result from an estimated 1 matches for "cragentlist".
Did you mean:
agentlist
2012 Jan 03
0
Create and Initialize List values
Dear all,
seasons greetings,
I had made a list of elements that I want to have
# list generator
Agent<-list(id=NA, position=list(x=NA,y=NA))
# Make list of Agents
AgentList<-rep(list(CRAgent),5)
# Initialization. Is it shorter to do that with a lapply statement?
for (i in c(1:length(CRAgentList))){
AgentList[[i]]$id=i
}
The created struct looks like
> str(AgentList)
List of 5
$ :List of 3
..$ id : int 1
..$ position :List of 2
.. ..$ x: logi NA
.. ..$ y: logi NA
..$ CRAgentPowerReceived: num [1:10, 1:10] 0 0 0 0 0 0 0 0 0 0 ...
$ :List of 3...