When using RPostgreSQL I find that I cannot use sqldf in the same way. For example if I load the library and read in data into a data frame using the following code:
library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, host="localhost", user="postgres", password="xxx", dbname="yyy", port="5436")
rs <- dbSendQuery(con, "select * from table");                           
df<- fetch(rs, n = -1); dbClearResult(rs) 
dbDisconnect(con) 
I know have the contents of this table in the dataframe df. However if I want to run a SQL command using sqldf I would previously do something like this:
sqldf("SELECT * FROM df WHERE X > 10")
This no longer works as I get the error message:
Error in postgresqlNewConnection(drv, ...) : 
  RS-DBI driver: (could not connect postgres@localhost on dbname "test"
)
Error in !dbPreExists : invalid argument type
I assume this is operator error on my part, but I can't figure how what arguments to supply to sqldf so that it just focuses on the data frame and does not try to connect to anything else.
 
     
     
     
    