[R] txtStart creates a NULL file

Simon Kiss sjkiss at gmail.com
Tue Feb 14 21:50:36 CET 2012

Hello all: 
I'm trying to use the following code to get commands, comments and results to a .txt file.  It only appears to capture comments. When I comment those out with #, it creates a NULL file.  
Someone seemed to have a similar problem with a mac GUI (https://stat.ethz.ch/pipermail/r-help/2010-September/253177.html) but the result seemed to be ambiguous. Is there a work-around? Reproducible code and sessioninfo are below.   The OS is Mac OS 10.6.8.

Yours truly, Simon Kiss

data("Forbes2000", package="HSAUR")
#This is a test of R output for the blind
txtStart('test.txt', commands=TRUE, results=TRUE)
txtComment('This command provides the mean profit in the data set')
mean(Forbes2000$profits, na.rm=TRUE)
txtComment('This command provides the standard deviation of the profits data set')
sd(Forbes2000$profits, na.rm=TRUE)
txtComment('This command provides the average profit by country')
aggregate(Forbes2000$profits, by=list(Forbes2000$country), function(x) mean(x, na.rm=TRUE))


R version 2.13.2 (2011-09-30)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

[1] en_CA.UTF-8/en_CA.UTF-8/C/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] TeachingDemos_2.7

loaded via a namespace (and not attached):
[1] tools_2.13.2

More information about the R-help mailing list