Displaying 1 result from an estimated 1 matches for "gridrow".
Did you mean:
grid_rows
2013 Feb 03
1
Looping through rows of all elements of a list that has variable length
...# and do something with both, - see example below.
# Below, I am doing it "manually" by using expand.grid to create all
combinations of rows of 2 elements of 'l.long':
mygrid<-expand.grid(1:nrow(l.long[[1]]),1:nrow(l.long[[2]]))
out<-vector("list",nrow(mygrid))
for(gridrow in 1:nrow(mygrid)){ # gridrow<-1
row.a<-mygrid[gridrow,1]
row.b<-mygrid[gridrow,2]
out[[gridrow]]<-sum(l.long[[1]][row.a,])+sum(l.long[[2]][row.b,])
}
Thank you very much for any suggestions!
--
Dimitri Liakhovitski
gfk.com <http://marketfusionanalytics.com/>
[[alt...