Displaying 1 result from an estimated 1 matches for "cragentpowerreceiv".
Did you mean:
cragentpowerreceived
2012 Jan 03
0
Create and Initialize List values
...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
..$ id : int 2
..$ 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 ...
What I want to do is to initialize every struct with an id...