[英]R- too many columns when using sqldf to join dataframes
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.第一df是acutedm11
与4682列和第二个是gwlfullflattened22
与4903列。 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我正在尝试根据 mrn=mrn_G 和日期差异 <= 30 合并这两个 dfs
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
错误: Error: too many columns on acutedm11
Is there a better way to merge/join the data frames?有没有更好的方法来合并/加入数据框?
The maximum number of columns is a compile time parameter in SQLite (which is included in the RSQLite package).最大列数是 SQLite(包含在 RSQLite 包中)中的编译时参数。 You can reset the limit higher and rebuild that package.您可以重新设置更高的限制并重建该包。 For more info see: Maximum number of columns in a table for sqlite有关更多信息,请参阅: sqlite 表中的最大列数
Also sqldf supports 4 different back end: SQLite, H2, MySQL and PostgreSQL. sqldf 还支持 4 种不同的后端:SQLite、H2、MySQL 和 PostgreSQL。 Try one of the others.尝试其中之一。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.