ubuntu下升級R版本
在測試《機器學習 實用案例解析》一書的郵件分類代碼時,windows系統下rstudio中無法讀取特殊字符,在ubuntu下可以。在ubuntu虛擬機下安裝tm包(install.packages("tm"))時,提示R版本過低(需要3.1,但是只有3.0,最新版本是3.2),百度了下,網上的資料說,需要配置下/etc/apt/sources.list文件,即下載列表,包括R官方網站給出的方法也是如此。這些資料和R官網的說明地址如下:
http://blog.fens.me/r-install-ubuntu/
http://my.oschina.net/explore/blog/102481
但是按照上面的說明嘗試,卻遇到錯誤:
The following packages have unmet dependencies: r-base : Depends: r-base-core (>= 3.2.2-1quantal0) but it is not going to be installed Depends: r-recommended (= 3.2.2-1quantal0) but it is not going to be installed Recommends: r-base-html but it is not going to be installed E: Unable to correct problems, you have held broken packages.
以“ubuntu 升級r版本”為關鍵字百度,始終沒有找到解決辦法。
以“ubuntu 更新r版本 the following packages have unmet dependencies r-base-core”為關鍵字搜索,找到stackoverflow上面的一個帖子(http://stackoverflow.com/questions/15260250/re-installing-r-linux-ubuntu-unmet-dependencies-r),其中提到的解決方法是:
Try this
If you have added a line from new ubuntu repository to /etc/apt/sources.list, erase the line. Then, run the commands
sudo add-apt-repository ppa:marutter/rrutter
sudo apt-get update
sudo apt-get upgrade
It worked for me, the answer comes from here http://r.789695.n4.nabble.com/Upgrading-on-Ubuntu-from-2-11-1-to-2-15-1-td4636965.html
問題解決,R版本升級到3.2.2,安裝tm,ggplot2包成功。