I had a collection of .bat files running R scripts on my computer that were
working perfectly. I then reformatted my computer and now I can't get them
working again. I have spent many days scouring the internet but have not
found a solution to my problem.

I created a simple piece of code named 'test 1.0.R' to try to find the
source of my problem. It contains the following -

time<-as.data.frame(Sys.time())
names(time)<-"time"
write.csv(time,"~Documents\\Test.csv")

library(RMySQL)
drv<-dbDriver("MySQL")
con<-dbConnect(drv,dbname="test",user="root",password=pwd)
dbWriteTable(con,"test_time",time,row.names=F,append=T)
dbDisconnect(con)

When I source this code from R.exe it creates the csv file and updates the
database as it should. When I run my batch file ("C:\Program
Files\R\R-2.13.1\bin\x64\R.exe" CMD BATCH --vanilla "~Documents\Test 1.0.R")
it writes the csv file but does not update the database.

I have no idea what I am missing here and it's driving me nuts. Is anyone
able to tell me why the batch file can write the csv but not write to the
database?

Thanks in advance for any answers provided,
Jai

	[[alternative HTML version deleted]]

