Hi Amy,
Suppose I have a dataframe as given below.
DF = data.frame(X = c("US", "UK", "Canada", "Australia", "Newzealand"), Y =
c(52, 36, 74, 10, 98))
drv <- dbDriver("SQLite")
tfile <- tempfile()
con <- dbConnect(drv, dbname = tfile)
data(DF)
dbWriteTable(con, ......., .......) # Didn't know what to write here.
data() loads data sets which ship with R or an extension package. Your
data frame DF is already in the working environment, hence it is neither
possible nor necessary to "load" it, the expression
data(DF)
is an error. The command to write DF to a database would be something like
dbWriteTable(con, "DF", DF)
where the second argument is the name of the database table to write to, the
third argument the data frame you want to write (please have a look at the
documentation).
I understand I have raised a query in a stupid manner. I need to understand is
there any way I can use SQLite to read
dataframe or for that matter any csv file say e.g. 'DF.csv'.
To copy a CSV file to SQLite, read it via read.table() or read.csv() first,
then copy the result with dbWriteTable. There might be a way to read files
directly from SQLite, but I don't know about that.
Best regards,
Andreas
--
Andreas Borg
Medizinische Informatik
UNIVERSITÄTSMEDIZIN
der Johannes Gutenberg-Universität
Institut für Medizinische Biometrie, Epidemiologie und Informatik
Obere Zahlbacher Straße 69, 55131 Mainz
www.imbei.uni-mainz.de
Telefon +49 (0) 6131 175062
E-Mail: b...@imbei.uni-mainz.de
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen.
Wenn Sie nicht der
richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren
Sie bitte sofort den
Absender und löschen Sie diese Mail. Das unerlaubte Kopieren sowie die
unbefugte Weitergabe
dieser Mail und der darin enthaltenen Informationen ist nicht gestattet.
______________________________________________
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.