Re: [R] export from R to MySQL

From: bogdan romocea <br44114_at_gmail.com>
Date: Tue 13 Dec 2005 - 01:55:04 EST

That was just an example -- it's not difficult to write an R function to generate the mysql create table syntax for a data frame with 60 or 600 columns. (BTW, I would never type 67 columns.)

On 12/12/05, Sean Davis <sdavis2@mail.nih.gov> wrote:
>
>
>
> On 12/12/05 9:21 AM, "bogdan romocea" <br44114@gmail.com> wrote:
>
> >> Sean Davis wrote:
> >> but you will have to create the table by hand
> >
> > There's no need for manual steps. To take advantage of MySQL's
> > extremely fast 'load data infile' you could dump the data in CSV
> > format, write a script for mysql (the command line tool), for example
> >
> > q <- function(table,infile)
> > {
> > query <- paste("
> > create table ",table," (col1 float, col2 float);
>
> This is creating the table by hand, as opposed to using dbWriteTable. If
> your data.frame contains 67 columns, using dbWriteTable saves quite a bit of
> typing....
>
> Sean
>
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Dec 13 02:28:59 2005

This archive was generated by hypermail 2.1.8 : Tue 13 Dec 2005 - 04:30:45 EST