您的位置:首页 > 运维架构 > Linux

Install R and RStudio on Ubuntu

2015-09-23 21:40 676 查看
I wanted to try Linux system thus I formatted an old laptop bought 7 years ago (HP Pavilion dm3, French keyboard).

No doubt that I need R and RStudio to be installed on this laptop…

Install R

Software Center

In the software center, you can easily find an official R app under Category “Science & Engineering :: Mathematics”.

Installed that, I tried to installed packages “dplyr” but failed - error message told me that the current version is ver. 3.0.x…

That definitely doesn’t meet my needs because I’m using ver. 3.2.2 on WIN7. We need to remove it and reinstall it by cmd line.

Cmd Lines

On Cran-R homepage, there is an index led to Ubuntu installation instruction.

The first thing to do is to “add an entry in your /etc/apt/sources.list file” (one of the 3 lines below, anyone is OK):

deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu vivid/
deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu trusty/
deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu precise/


Where “https://

deb http://cran.rstudio.com/bin/linux/ubuntu precise/


Again! IT IS NOT A COMMAND!

Remember that I’ve already installed R of an older version, I need to remove that beforehand. Ignore that if you never install it.

sudo apt-get remove r-base-core


According to the official instruction, to install the complete R system, use:

sudo apt-get update
sudo apt-get install r-base


But that didn’t work, I got an error message:

The following packages have unmet dependencies:
r-base : Depends: r-base-core (>= 3.2.2-1ubuntu0) but it is not going to be installed
Depends: r-recommended (= 3.2.2-1ubuntu0) 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.


By scrolling down the instruction:

The Ubuntu archives on CRAN are signed with the key of “Michael Rutter marutter@gmail.com” with key ID E084DAB9.

To add the key to your system and finish the installation with the commands:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo add-apt-repository ppa:marutter/rdev
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base


Install RStudio

To install RStudio, you can directly download the .deb package from https://www.rstudio.com/products/rstudio/download/. Once it’s downloaded, software center will pop up a window asking for installation.

Reference:

Installing latest version of R-base
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ubuntu linux R RStudio