如何在Ubuntu云服务器上设置RStudio

来自菜鸟教程
跳转至:导航、​搜索

什么是 RStudio?

RStudio IDE是一个开源的I集成D开发E环境,用于统计分析程序R。 RStudio Server 提供了一个 Web 版本的 RStudio IDE,允许在 VPS 上轻松开发。 由于我们的 VPS 是按小时计费的,因此启动一个 24 核实例、处理一些数据然后销毁 VPS 非常便宜。

在 VPS 中安装 RStudio

首先,安装 R、apparmor 和 gdebi。

sudo apt-get install r-base libapparmor1 gdebi-core

接下来,为您的架构下载并安装正确的软件包。 在 32 位 Ubuntu 上,执行以下命令。

wget http://download2.rstudio.org/rstudio-server-0.97.336-i386.deb -O rstudio.deb

在 64 位 Ubuntu 上,执行以下命令。

wget http://download2.rstudio.org/rstudio-server-0.97.336-amd64.deb -O rstudio.deb

安装软件包。

sudo gdebi rstudio.deb

创建 RStudio 用户

不建议在 RStudio 中使用 root 帐户,而是为 RStudio 创建一个普通用户帐户。 该帐户可以命名为任何名称,并且帐户密码将是在 Web 界面中使用的密码。

sudo adduser rstudio

RStudio 将使用用户的主目录作为其默认工作区。

使用 R Studio

RStudio 可以通过 8787 端口访问。 任何带有密码的用户帐户都可以在 RStudio 中使用。

让 ' 通过从 R 包存储库 CRAN 安装量化金融包来测试 RStudio 是否正常工作。

在 RStudio 中运行以下命令来安装 quantmod

install.packages("quantmod")

接下来,让我们通过绘制苹果的股价来测试 RStudio 的绘图能力。 该图将出现在 RStudio 的右下方面板中。

library('quantmod')
data 

R is a really powerful tool and there are hundreds of useful packages available from CRAN. You can learn the basics of R at Try R.
To learn how to install R packages from CRAN and GitHub and how to ensure that these packages are made available for all users on the same Droplet, check out How To Set Up R on Ubuntu 14.04.