I have a large dataset with nearly 2000 variables in r. I then use sqldf to write a few case statements to create new columns on the original dataset. However I get the following error:
Error in rsqlite_send_query(conn@ptr, statement) : too many SQL variables
I rebooted my laptop today and previously this error never occured.
Any help is appreciated.
I hit the same problem. I just limited the number of columns
# 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 ")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With