i have a dcast()
application whose cross-product exceeds .Machine$integer.max
. is there a recommended alternative to dealing with this situation? i could break up w
into smaller pieces, but was hoping for a clean solution.
this might be a duplicate of R error when applying dcast to a large data.table object but that question also doesn't have an answer.
thanks!
library(data.table)
# three million x one thousand
w <- data.table( x = 1:3000000 , y = 1:1000 )
z <- data.table::dcast( w , x ~ y , value.var = 'x' )
# Error in CJ(1:3000000, 1:1000) :
# Cross product of elements provided to CJ() would result in 3e+09 rows which exceeds .Machine$integer.max == 2147483647