I tried to merge two data.frames, and they are like below:
GVKEY YEAR coperol delta vega firm_related_wealth 1 001045 1992 1 38.88885 17.86943 2998.816 2 001045 1993 1 33.57905 19.19287 2286.418 3 001045 1994 1 48.54719 16.85830 3924.053 4 001045 1995 1 111.46762 38.71565 8550.903 5 001045 1996 1 218.89279 45.59413 17834.921 6 001045 1997 1 415.61461 51.45863 34279.515
AND
GVKEY YEAR fracdirafter fracdirafterindep twfracdirafter 1 001004 1996 1.00 0.70 1.000000000 2 001004 1997 0.00 0.00 0.000000000 3 001004 1998 0.00 0.00 0.000000000 4 001004 1999 0.00 0.00 0.000000000 5 001004 2000 0.00 0.00 0.000000000 6 001004 2001 0.25 0.25 0.009645437
They both have 1,048,575 rows. My code is merge(a,b,by=c("GVKEY","YEAR"))
, I kept receiving error message “negative length vectors are not allowed
“. I also tried the data.table way, but got error message saying that my results would exceed 2^31 rows. Apparently, the merged data will not be so big, so I am not sure how to solve this issue.