Re: [R] File to MYSQL

2011-05-16 Thread Phil Spector
If you're using the RMySQL package, the obvious choice for writing a data frame to a table is dbWriteTable. Note the append= argument, which if set to TRUE, will allow you to write as much or as little to the database as you need. But before you do that, you should probably try to understand how l

Re: [R] File to MYSQL

2011-05-16 Thread Jerome Asselin
On Mon, 2011-05-16 at 17:01 -0300, Nilza BARROS wrote: > Hi, Jerome > > I was trying to use RMYSQL > > for (i in length(Query)) { > rs1<-dbSendQuery(con,Query[i]) > } > > But although the Query have several lines the command above just feed > my database with the first one. > > > Query > [

Re: [R] File to MYSQL

2011-05-16 Thread Nilza BARROS
Dear Jerome, I am a little ashamed about myself because the solutions is very easy. I thought I have already read help about write.table. But in fact I would like to use the RMysql to feed my database if you know something about I'd like to know. Bye and Thanks. On Mon, May 16, 2011 at 5:01 PM,

Re: [R] File to MYSQL

2011-05-16 Thread Patrick Connolly
On Mon, 16-May-2011 at 02:55PM -0300, Nilza BARROS wrote: |> Dear R-user, [...] |> 2) My script |> |> outfile<- with(as.data.frame(Alldados),sprintf("INSERT INTO OBS |> (date,TMAX_2M,TMIN_2M,TD_2M,PS,FF_10M,DD_10M,Station_NO) VALUES (%s, %s, %s, |> %s,%s,%s,%s,%s)",date2,TMAX_2M,TMIN_2M,TD_2M,P

Re: [R] File to MYSQL

2011-05-16 Thread Nilza BARROS
Hi, Jerome I was trying to use RMYSQL for (i in length(Query)) { rs1<-dbSendQuery(con,Query[i]) } But although the Query have several lines the command above just feed my database with the first one. > Query [1] "INSERT INTO OBS (date,T_2M,TMAX_2M,TMIN_2M,TD_2M,PS,FF_10M,DD_10M,TOT_PRCP,CLCL,

Re: [R] File to MYSQL

2011-05-16 Thread Jerome Asselin
On Mon, 2011-05-16 at 14:55 -0300, Nilza BARROS wrote: > Dear R-user, > > I have to feed my database using some SQL commands. I have already read a > data frame with the data I need but > after that these data should be write in a file wtih SQL commands. > > 1) My dataframe: > > dput(Alldados)

[R] File to MYSQL

2011-05-16 Thread Nilza BARROS
Dear R-user, I have to feed my database using some SQL commands. I have already read a data frame with the data I need but after that these data should be write in a file wtih SQL commands. 1) My dataframe: dput(Alldados) structure(list(Station_NO = c(836490, 836920, 836950, 836980, 837380, 83