I have two data tables.
Table 1: 1349445 rows and 21 cols
Table 2: 3235 rows x 4 cols
Table 1:
YEAR STATE_NAME CROP .......
1990 Alabama Cotton
1990 Alabama Cotton
1990 Alabama Peanuts
.
.
.
Table 2:
STATE STATEFP COUNTYFP STATE_NAME
AK 2 13 Alaska
AK 2 16 Alaska
AK 2 20 Alaska
AK 2 50 Alaska
I want to merge the two tables by "STATE_NAME"
Table 1 <- data.table(Table 1)
Table 2 <- data.table(Table 2)
setkeyv(Table 1, c("STATE_NAME"))
setkeyv(Table 2, c("STATE_NAME"))
Hydra_merge <- merge(Table 1, Table 2, all.x = TRUE)
I am getting the below error. Can somebody help me to figure out what I am doing wrong here.
Thanks in advance.
Error in vecseq(f__, len__, if (allow.cartesian || notjoin || !anyDuplicated(f__, :
Join results in 141691725 rows; more than 1352680 = nrow(x)+nrow(i). Check for duplicate key values in i each of which join to the same group in x over and over again. If that's ok, try by=.EACHI to run j for each group to avoid the large allocation. If you are sure you wish to proceed, rerun with allow.cartesian=TRUE. Otherwise, please search for this error message in the FAQ, Wiki, Stack Overflow and datatable-help for advice.