If I copy the following commands in my batch file to the R console, R 
creates a file named "basicStatsIBM.lis" with the program output in it:

Sortie <- file(description = "basicStatsIBM.lis", open = "wt", blocking = 
TRUE,
     encoding = "UTF-8")
sink(file = Sortie, append = FALSE, type = "output", split = FALSE)
basicStats(ibm)
close(Sortie)

However, the same commands in a text file (named batch.txt, for instance) 
referred to from the R console by the command source("batch.txt") yields an 
empty "basicStatsIBM.lis" file.

Why the discrepancy in processing?
How to make the batch commands work as if the commands were pasted directly 
in the R console?
A solution to this problem would save time and aggravation to many people.  
Thank you.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to