Install R and RStudio on Ubuntu

本文档介绍了如何在Ubuntu系统上安装R和RStudio。首先,通过软件中心安装R,但发现版本过旧,因此通过命令行进行卸载和重新安装。在Cran-R官网找到Ubuntu安装指南,添加apt源并更新系统,然后尝试安装R,遇到错误,需要导入签名密钥。最后,直接下载RStudio的.deb包并通过软件中心完成安装。
摘要由CSDN通过智能技术生成

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值