R语言教程:环境安装

2022-08-0211:13:16编程语言入门到精通Comments787 views字数 1252阅读模式

R 语言的开发环境本身具备了图形开发环境,这与其他很多工程语言是不同的,所以开发环境最好安装在为桌面个人计算机设计的操作系统上(如 Windows, macOS 或 Ubuntu 桌面版 等)。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

首先,我们需要下载 R 语言环境的安装包:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

Windows

Linux

macOS

以上的版本有可能是过时的,如果你需要最新版本,可以访问:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html


Windows 操作系统

Windows 安装很简单,下载安装包后,双击下载的安装包,开始安装向导:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

注意:这里使用的操作系统是 64 位的,但现在仍有少数的计算机使用的是 32 位的操作系统,如果你的操作系统是 32 位的,请在此步骤选择"32-bit 用户安装"选项。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

当我们在交互式的命令窗口输入以下代码:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

print("Hello, world")

输出结果为:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

"Hello, world"

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

Linux

Ubuntu 安装

执行以下命令安装 R 语言执行环境:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

# sudo apt update
# sudo apt -y upgrade
# sudo apt -y install r-base

安装成功后,执行 R 命令就可以进入交互式的编程窗口了:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

Centos 安装

# sudo yum install R

输入以下命令,查看安装的版本:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

# R --version

交互式命令可以通过输入 q() 来退出:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

> q()
Save workspace image? [y/n/c]: y

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

macOS 安装

macOS 安装 R 语言环境类似 Windows,下载 pkg 安装包,双击安装包打开,然后按安装向导安装:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

安装成功后,执行 R 命令就可以进入交互式的编程窗口了:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

交互式命令可以通过输入 q() 来退出:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

> q()
Save workspace image? [y/n/c]: y

R语言教程:环境安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/ymba/26422.html

  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/ymba/26422.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定