[R-sig-DB] A question about dbWriteTable command in R under MS Windows
Jeffrey Horner
je||@horner @end|ng |rom v@nderb||t@edu
Tue Mar 10 22:43:02 CET 2009
Hi,
HU,ZHENGJUN wrote on 03/10/2009 04:32 PM:
> Dear Sir/Madam,
>
> I wrote the following R code (see below) to store the data frame of
> "test.01" into the table of "ttest01" in my database which is located on
> a Linux machine. If the code was run under MS Windows XP, I have found
> that the values in the last column (i.e. column f5) in the table are all
> zeros instead of NULLs. If the same R code was run under Linux, however,
> everything is OK. The R version is 2.6.0 under both MS Windows XP and
> Linux.
>
> Does anyone know how to solve this problem under MS Windows XP?
I suggest you upgrade to the latest version of R and the latest version
of RMySQL and run your test again. I doubt R 2.6.0 is the problem, but
you haven't told us which version of RMySQL you are using. The latest
version of RMySQL is 0.7-3, and a fix was made to dbWriteTable() in the
0.7-2 version.
Best,
Jeff
>
> Thank you very much for the help and time in advance. Howard
>
> ********************************************************************************************
>
> library(DBI)
> library(RMySQL)
> mysqldrv <- dbDriver("MySQL")
> conn.2.database<-
> dbConnect('myHostName','myUserName','myPassword','myDatabaseName')
> test.01=data.frame(f1=c("A","B","C"),f2=c(1,2,3),f3=c(NA,NA,NA),f4=c(NA,NA,NA),f5=c(NA,NA,NA))
>
> dbWriteTable(conn.2.database, "ttest01", test.01, row.names=F, eol='\r\n')
> dbDisconnect(conn.2.database)
>
> _______________________________________________
> R-sig-DB mailing list -- R Special Interest Group
> R-sig-DB using stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-db
--
http://biostat.mc.vanderbilt.edu/JeffreyHorner
More information about the R-sig-DB
mailing list