在过去的几天里,我一直在努力完成Norman Matloff的 R编程艺术。本书的第一个例子如下:
# test.R
# Creates a histogram of 100 normal variates and saves it to xh.pdf.
pdf("xh.pdf")
hist(rnorm(100))
dev.off()
作者说执行$ R CMD BATCH test.R
会生成 xh.pdf ,但这并不起作用。我用google搜索&#34; R批处理模式&#34;并设法使用$ R --no-save < test.R
生成PDF文件。任何人都知道为什么第二种方法有效,但第一种方法没有?
更多信息:我在OSX El Capitan上。 $ R CMD BATCH test.R
生成一个文件 test.Rout ,其中包含以下内容:
/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
答案 0 :(得分:1)
我按照here列出的步骤解决了这个问题。
- 将其符号链接到我的自制文件夹ln -s / opt / X11 / include / X11 / usr / local / include / X11(请注意您的自制程序目录可能是 不同)
- brew install homebrew / dupes / tcl-tk
- brew链接 - 覆盖 --force tcl-tk; brew unlink tcl-tk brew重新安装-s r
醇>