You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FR: if CJ is passed data.table arguments, do a blocked cross-join #2343
I have a case where I don't want the outer product of all rows of some input, but rather the outer product of all blocks of rows of the input. It seems natural that CJ should be able to handle constructing this:
The order isn't particularly natural here, but doesn't matter in my application. Worse is that it's clunky and not easily extensible to having several more data.tables of input.
Most natural in current functionality (wrong) is CJ(DT1$x1, DT1$x2, DT2$y1), but this has too many rows and must be pared back.
I have a case where I don't want the outer product of all rows of some input, but rather the outer product of all blocks of rows of the input.
I don't see the distinction here. There are two rows in one table; three in the other; and the Cartesian product in the result (regarding rows as tuples and tables as sets of tuples), unless you just mean the row order.
Worse is that it's clunky and not easily extensible to having several more data.tables of input.
Not sure if that's what you're after. I'm not crazy about the row ordering, so I'd probably do cbind(DT1[rep(1:.N, each=nrow(DT2))], DT2) instead, fwiw.
Activity
st-pasha commentedon Sep 8, 2017
How about this:
franknarf1 commentedon Sep 8, 2017
I don't see the distinction here. There are two rows in one table; three in the other; and the Cartesian product in the result (regarding rows as tuples and tables as sets of tuples), unless you just mean the row order.
With
Reduce...Not sure if that's what you're after. I'm not crazy about the row ordering, so I'd probably do
cbind(DT1[rep(1:.N, each=nrow(DT2))], DT2)instead, fwiw.Btw, I guess this is related to Jan's CJ.dt #1717
MichaelChirico commentedon Oct 23, 2017
Indeed I think #1717 covers this. Closing.