[R] Efficient Cartesian product of data.frames

Timothy W. Victor tvictor at dolphin.upenn.edu
Fri Sep 10 02:40:43 CEST 2004


Hello List,

I am looking for efficient code to produce the Cartesian product of two 
or more data.frames. I'd like to be able to do this without resorting to 
looping. I have searched the FAQ, web, etc without luck. That being 
said, the help page for merge says that the function can produce what 
I'm looking for if the by vectors are of zero length. Would someone be 
so kind as to provide me with a quick example of exactly how to do this?

Cheers,

Tim Victor




More information about the R-help mailing list