R freezes in Mac OS X Yosemite

夙愿已清 提交于 2019-12-01 16:48:06

I have run into the same problem. I haven't tried Metallica's answer but found the problem has 95% disappeared after installing the latest "patch" version of R , as found at att.com .

Apparently, this is a bug in R's GUI. Some OS X features/libraries that used to be in place in earlier versions of OS X have been removed in Yosemite.

You can work around this bug by running R from the terminal / command line. Fire up the terminal app (quickest way is to use Spotlight search: cmd+space -> terminal), and type in (or paste) the following command:

/Applications/R.app/Contents/MacOS/R

Also avoid using the Misc menu or other GUI elements if you can. Using the change working directory menu entry in the Misc menu causes a freeze. You can use the R command setwd() instead, e.g.:

setwd("path/to/your/working/directory")

There is a problem though, you have to change your working directory every time you open up R. To make the change permanent, put the above command (setwd) in your R's init file (.Rprofile) in your home directory. If you cannot find .Rprofile, that is fine, create a file in your home directory, name it .Rprofile, and paste the command there. This file is executed by R every time you open up R.

The newest version (Wooden Christmas Tree 3.2.3 and the GUI 1.66) that were released on December 10, 2015 appear to have corrected this problem. It does require you have Maverick or newer OS. I've only performed limited trials, including opening with the GUI rather than through terminal, and have not had any hangs.

For anyone here with version 3.4.1 (2017-06-30) -- "Single Candle" and running Mac OS X Sierra 10.12.6 with the same problem, I find that I can usually save an image I create if I save it in the current working directory. However, if you need to save an image in a specific location and the GUI freezes up, try the following command (for pdf images):

pdf(/path/to/location/name.pdf)

plot(x, y, ...)

dev.off()
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!