I'm trying to merge two data frames into one. The first df is acutedm11 with 4682 columns and the second is gwlfullflattened22 with 4903 columns. I can't post the data here because its too big and it contains sensitive information. I'm trying to merge these two dfs based off of mrn=mrn_G and date difference <= 30
Code:
library(sqldf)
acutedm3 <- sqldf::sqldf("
select acutedm11.*, gwlfullflattened22.*
from acutedm11
left join gwlfullflattened22 on acutedm11.mrn = gwlfullflattened22.mrn_G
and gwlfullflattened22.EncounterDate_G between acutedm11.Date_m30 and acutedm11.Date_p30") %>%
select(-Date_m30, -Date_p30)
Error: Error: too many columns on acutedm11
Is there a better way to merge/join the data frames?