Have you considered the DBI and RODBC packages? I'm trying to do something like this myself right now, and a post of my own (to R-SIG-DB) produced recommendations for these two packages. Both have vignettes.

      Hope this helps.
      Spencer


On 10/9/2010 6:52 AM, Michael Bedward wrote:
Package RSQLite has a dbBuildTableDefinition that creates the CREATE
TABLE statement for a given a data.frame. I think other db related
packages for MySQL and PostgreSQL also have such a function.

Michael


On 10 October 2010 00:39, Gabor Grothendieck<ggrothendi...@gmail.com>  wrote:
On Sat, Oct 9, 2010 at 9:02 AM, johannes rara<johannesr...@gmail.com>  wrote:
Thanks, but I'm not looking for a function to save dataframes into a
RDBMS. I'm looking for a function which creates CREATE TABLE and
INSERT statements from a dataframe.

If the reason you want that is so you can manipulate R data frames in
SQL then the sqldf package does that.  There are no create statements
to issue and no insert statements to issue (although you can).  The
database is automatically created, the create and insert statements
are automatically generated and executed, your SQL statement is run,
the result is automatically retrieved and the database is
automatically destroyed afterwards.  You just specify a select or
other sql statement with the data frame name(s) replacing the table
name(s).  It works with built-in data frames that ship with R and with
data frames you create yourself.  See http://sqldf.googlecode.com for
more.

--
Statistics&  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
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.

______________________________________________
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.




--
Spencer Graves, PE, PhD
President and Chief Operating Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567

______________________________________________
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