Dear R helpers

Suppose following is an output due to some R process. I wish to save it as a 
table in 'temp.db'

df <- data.frame(x = c(5, 4, 3, 11), y = c(25, 16, 9, 121))

    library(RSQLite)
    write('** Initializing','')

    drv <- dbDriver("SQLite", shared.cache = TRUE)
    con <- dbConnect(drv, dbname = "temp.db",
 loadable.extensions=TRUE)

    on.exit(dbUnloadDriver(drv))
    on.exit(dbDisconnect(con))

write('** Save output', '')

 dbBeginTransaction(con)

 dbGetPreparedQuery(con, "INSERT INTO output(df) VALUES (?)", 
data.frame(output))

 dbCommit(con)
 
 
> 
 dbGetPreparedQuery(con,
                        "INSERT INTO output(df) VALUES (?)",
                         data.frame(output))


# 
---------------------------------------------------------------------------------

I get following message

Error in dbGetPreparedQuery(con, "INSERT INTO output(df) VALUES (?)",  : 
  error in evaluating the argument 'bind.data' in selecting a method for 
function 'dbGetPreparedQuery'
 


      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to