I've been working through The Art of R Programming by Norman Matloff for the past couple of days. One of the first examples in the book is the following:
# test.R
# Creates a histogram of 100 normal variates and saves it to xh.pdf.
pdf("xh.pdf")
hist(rnorm(100))
dev.off()
The author says executing $ R CMD BATCH test.R
would generate xh.pdf, but that didn't work. I googled "R batch mode" and managed to generate the PDF file using $ R --no-save < test.R
. Anyone know why the second method works but the first doesn't?
More Info: I'm on OSX El Capitan. $ R CMD BATCH test.R
produces a file, test.Rout, that contains the following:
/usr/local/Cellar/r/3.3.0/R.framework/Resources/bin/R: line 201:
/usr/local/Library/ENV/4.3/sed: No such file or directory