Most looping code looks like this
retVal=NULL
for i {
for j {
result <- *some function of vector[i] and vector[j]*
retVal = rbind(retVal,result)
}
}
Since this is so common, is there a systematic way of translating this idiom?
Can this be extended to most loops?
The plyr package provides a set of general tools for replacing looping constructs when you’re work with a big data structure by breaking it into pieces, processing each piece independently and then joining the results back together.