我有一个大型数据集,r中有近2000个变量.然后我使用sqldf编写一些case语句来在原始数据集上创建新列.但是我收到以下错误:
Error in rsqlite_send_query(conn@ptr, statement) : too many SQL variables
我今天重新启动了我的笔记本电脑,此前此错误从未发生过.
任何帮助表示赞赏.
最佳答案 我遇到了同样的问题.我只限制了列数
# here creating data with alot of columns
a<- mtcars
for( i in 1:1000 ){
b <- mtcars
colnames(b) <- paste( colnames(b), i , sep="_")
a <- cbind( b , a )
}
ncol( a )
# I get the error here
sqldf( "Select SUM( wt) as weights from a ")
#so I just limited the columns
z <- a[ , c( "gear","wt")]
# and than this works
sqldf( "Select SUM( wt ) as weights from z ")