[R-sig-DB] A question about dbWriteTable command in R under MS Windows

HU,ZHENGJUN hhu @end|ng |rom u||@edu
Tue Mar 10 22:32:40 CET 2009


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?

  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)




More information about the R-sig-DB mailing list