R 环境设置
本地环境设置
如果您仍然愿意为 R 设置环境,则可以按照以下步骤操作。
Windows 安装
您可以从 R-下载 R 的 Windows 安装程序版本3.2.2 for Windows(32/64 位) 并将其保存在本地目录中。
因为它是一个名为"R-version-win.exe"的 Windows 安装程序 (.exe)。您只需双击并运行接受默认设置的安装程序即可。如果您的 Windows 是 32 位版本,它会安装 32 位版本。但如果您的 Windows 是 64 位,那么它会同时安装 32 位和 64 位版本。
安装后,您可以在Windows Program Files下的目录结构"R\R3.2.2\bin\i386\Rgui.exe"中找到运行程序的图标。单击此图标会显示 R-GUI,这是进行 R 编程的 R 控制台。
Linux 安装
R 在 R 二进制文件。
安装 Linux 的说明因风格而异。这些步骤在提到的链接中的每种类型的 Linux 版本下都有提到。但是,如果您赶时间,那么您可以使用
yum 命令来安装 R,如下所示-
以上命令将安装 R 编程的核心功能以及标准包,但您仍然需要额外的包,然后您可以按如下方式启动 R 提示符-
$ R
R version 3.2.0 (2015-04-16)--"Full of Ingredients"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-redhat-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.
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.
>
现在您可以在 R 提示符下使用 install 命令来安装所需的包。例如,以下命令将安装 3D 图表所需的
plotrix 包。
> install.packages("plotrix")