Thursday, 15 July 2010

Loading SQLite table in R with RSQLite -



Loading SQLite table in R with RSQLite -

i had function used load sqlite table

sqliteconnect <- function(database, table) { library(dbi) library(rsqlite) con <- dbconnect("sqlite", dbname = database) query <- dbsendquery(con, paste("select * ", table, ";", sep="")) result <- fetch(query, n = -1, encoding="utf-8") dbclearresult(query) dbdisconnect(con) return(result) }

but seams generates error

album <- sqliteconnect("~/downloads/chinookdatabase1.3_sqlite/chinook_sqlite.sqlite","album") error in (function (classes, fdef, mtable) : unable find inherited method function ‘dbconnect’ signature ‘"character"’ called from: stop(gettextf("unable find inherited method function %s signature %s", squote(fdef@generic), squote(cnames)), domain = na)

(i downloaded db here)

is bug or problem function?

sessioninfo() r version 3.1.2 (2014-10-31) platform: x86_64-apple-darwin13.4.0 (64-bit) locale: [1] en_au.utf-8/en_au.utf-8/en_au.utf-8/c/en_au.utf-8/en_au.utf-8 attached base of operations packages: [1] graphics grdevices utils datasets stats methods base of operations other attached packages: [1] ggplot2_1.0.0 igraph_0.7.1 rsqlite_1.0.0 dbi_0.3.1 loaded via namespace (and not attached): [1] colorspace_1.2-4 digest_0.6.4 grid_3.1.2 gtable_0.1.2 [5] mass_7.3-35 munsell_0.4.2 plyr_1.8.1 proto_0.3-10 [9] rcpp_0.11.3 reshape2_1.4 scales_0.2.4 stringr_0.6.2 [13] tools_3.1.2

from github

library(dbi) dbconnect(rsqlite::sqlite(), ...)

r sqlite rsqlite r-dbi

No comments:

Post a Comment