如何在Ubuntu和Debian上安装R.

什么是R?

R是包含了数据可视化功能的用于统计分析的编程语言。该语言通过Comprehensive R Archive Network(CRAN)拥有高度的可扩展性,该网络托管了10,000多个R包,用于生成出版数据,专用计算工具等。

虽然可以通过Debian或Ubuntu的源安装R,但本指南中的方法将确保您安装最新的稳定版本。

在Ubuntu 16.04和Debian 9 上安装R.

  1. 打开/etc/apt/sources.list并将以下文本添加到文件末尾: Ubuntu: deb http://cran.rstudio.com/bin/linux/ubuntu xenial/ Debian: deb http://cran.rstudio.com/bin/linux/debian stretch-cran34/
  2. 添加CRAN网络的密钥ID: Ubuntu GPG密钥: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 Debian GPG密钥: sudo apt install dirmngr sudo apt-key adv --keyserver keys.gnupg.net --recv-key 'E19F5F87128899B192B1A2C2AD5F960A256A04AF'
  3. 更新源: sudo apt update
  4. 安装R二进制文件: sudo apt install r-base

从CRAN 下载软件包

  1. 打开R解释器: R
  2. 解释器将输出一些有关版本的信息。输入install.packages("ggplot2"): R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > install.packages("ggplot2")
  3. 可用镜像列表会显示在屏幕上。选择最近的镜像位置以获得最大传输速度: --- Please select a CRAN mirror for use in this session --- HTTPS CRAN mirror 1: 0-Cloud [https] 2: Algeria [https] 3: Australia (Canberra) [https] 4: Australia (Melbourne 1) [https] 5: Australia (Melbourne 2) [https] 6: Australia (Perth) [https] 7: Austria [https] 8: Belgium (Ghent) [https] 9: Brazil (PR) [https] 10: Brazil (RJ) [https] 11: Brazil (SP 1) [https] 12: Brazil (SP 2) [https] 13: Bulgaria [https] 14: Canada (MB) [https] 15: Chile 1 [https] 16: Chile 2 [https] 17: China (Beijing) [https] 18: China (Hefei) [https] 19: China (Guangzhou) [https] 20: China (Lanzhou) [https] 21: China (Shanghai) [https] 22: Colombia (Cali) [https] 23: Czech Republic [https] 24: Denmark [https] 25: East Asia [https] 26: Ecuador (Cuenca) [https] 27: Estonia [https] 28: France (Lyon 1) [https] 29: France (Lyon 2) [https] 30: France (Marseille) [https] 31: France (Montpellier) [https] 32: France (Paris 2) [https] 33: Germany (Göttingen) [https] 34: Germany (Münster) [https] 35: Greece [https] 36: Iceland [https] 37: India [https] 38: Indonesia (Jakarta) [https] 39: Ireland [https] 40: Italy (Padua) [https] 41: Japan (Tokyo) [https] 42: Japan (Yonezawa) [https] 43: Malaysia [https] 44: Mexico (Mexico City) [https] 45: New Zealand [https] 46: Norway [https] 47: Philippines [https] 48: Serbia [https] 49: Singapore (Singapore 1) [https] 50: Spain (A Coruña) [https] 51: Spain (Madrid) [https] 52: Sweden [https] 53: Switzerland [https] 54: Taiwan (Chungli) [https] 55: Turkey (Denizli) [https] 56: Turkey (Mersin) [https] 57: UK (Bristol) [https] 58: UK (Cambridge) [https] 59: UK (London 1) [https] 60: USA (CA 1) [https] 61: USA (IA) [https] 62: USA (IN) [https] 63: USA (KS) [https] 64: USA (MI 1) [https] 65: USA (NY) [https] 66: USA (OR) [https] 67: USA (TN) [https] 68: USA (TX 1) [https] 69: Vietnam [https] 70: (HTTP mirrors) Selection:
  4. 退出解释器时,系统将提示您保存工作区镜像。如果选择“是”,则保存当前所有用户自定义对象以便下次使用: > q() Save workspace image? [y/n/c]:

RStudio IDE桌面

R解释器缺少调试器等功能,而大型项目可能需要这些功能。RStudio是一个IDE,它带有许多上手即用的开发工具。

  1. 下载RStudio: wget https://download1.rstudio.org/rstudio-xenial-1.1.414-amd64.deb
  2. 安装: sudo dpkg -i rstudio-xenial-1.1.414-amd64.deb 注意如果提示缺少依赖项,可以使用以下命令安装它们: sudo apt install -f

本文的版权归 魔法少女伊莉雅 所有,如需转载请联系作者。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏Android小菜鸡

Andorid pcm转码wav

参考文章:https://blog.csdn.net/hesong1120/article/details/79043482

2732
来自专栏小鹏的专栏

ubuntu下C++如何调用matlab程序

实验平台:   ubuntu  matlab R2016b   g++ 步骤: 1.    设置matlab的编译器 在命令行窗口下,输入并执行如下命令:m...

31710
来自专栏落影的专栏

OpenGLES进阶教程8-obj文件和mtl文件解析

教程 距离上一篇教程已经有两个月了,这两个月详细阅读GPUImage的源码,并写了详细解析,发现对OpenGLES的深入了解很有帮助。 上周一个简书的朋友问我...

4187
来自专栏哈雷彗星撞地球

Objective-C 中如何测量代码的效率背景

因此,我们不可避免的要用到一些方法来计算代码的执行效率。计算代码的执行效率可以使用的API有:

1285
来自专栏NetCore

Visual C#.Net网络程序开发-Tcp篇(3) 祥细内容:

综合运用上面的知识,下面的实例实现了简单的网络通讯-双机互连,针对客户端和服务端分别编制了应用程序。客户端创建到服务端的连接,向远程主机发送连接请求连接信号,并...

23010
来自专栏linux驱动个人学习

高通 display 驱动【转】

1.8K4
来自专栏吉浦迅科技

DAY5:阅读 CUDA C编程接口之CUDA C runtime

1464
来自专栏FreeBuf

Office”组合”式漏洞攻击样本分析

by hcl, nine8 of code audit labs of vulnhunt.com 1 概述 网上公开一个疑似CVE-2014-1761的RTF样...

2529
来自专栏向治洪

Android 增量更新和升级

在年初的时候,尝试了一把热修复技术,当时选择的是阿里的andfix,使用起来也很简单,这里就不在多少,如果你对andfix有兴趣请链接:点击打开链接。虽然网上将...

6489
来自专栏Java成长之路

Solr查询处理简介

所有与solr核心服务有关的交互,如查询处理,都是通过HTTP请求执行的。填写查询表单之后,创建一个HTTP Get请求并发送给Solr。

1102

扫码关注云+社区

领取腾讯云代金券