开发者

R x11 on Mac not functioning - or, functioning weirdly

I have a simple R script in a file Test.r:

x11()
plot(1,1)

From the terminal, I type "Rscript Test.r" and x11 opens and quickly flashes the 开发者_Go百科plot with a point at (1,1), and then quickly closes the window, however x11 remains open.

How do I keep the plot open? Why does it leave so quickly?


R will close the device when the process R dies (as it does when the script completes). The better way to do this is:

pdf("file.pdf")
plot(1,1)
dev.off()

then when you run through the Rscript it will save the file there. Otherwise, you'll have to have R stay alive which isn't really how it should be run in a script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜