Monday, October 28, 2013

RStudio Server : Installation on Ubunutu

What is RStudio?

RStudio IDE is an open source Integrated Development Environment for the statistical analysis program R. RStudio Server provides a web version of RStudio IDE that allows easy development on a VPS.

Since our VPSs are billed by the hour, it's surprisingly cheap to spin up a 24 core instance, crunch some data, and then destroy the VPS.

Installing RStudio In a VPS

First, install R, apparmor, and gdebi.
sudo apt-get install r-base libapparmor1 gdebi-core
Next, download and install the correct package for your architecture. On 32-bit Ubuntu, execute the following commands.
wget -O rstudio.deb
On 64-bit Ubuntu, execute the following commands.
wget -O rstudio.deb

Install the package.

sudo gdebi rstudio.deb

Creating RStudio User

It is not advisable to use the root account with RStudio, instead, create a normal user account just for RStudio. The account can be named anything, and the account password will be the one to use in the web interface.
sudo adduser rstudio

RStudio will use the user's home directory as it's default workspace.

Using R Studio

RStudio can be access through port 8787. Any user account with a password can be used in RStudio. 

Let's test that RStudio is working correctly by installing a quantitative finance package fromCRAN, the R package repository.

Run the following command inside RStudio to install quantmod.


Rstudio 1

Next, let's test out RStudio's graphing capabilities by plotting the stock price of Apple. The graph will appear in the bottom right panel of RStudio.

data <- new.env()
getSymbols('AAPL', data)

Rstudio 2

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.

1 comment:

  1. Pretty great post. I simply stumbled upon your blog and wanted to mention that I have really loved surfing around your blog posts. Great set of tips from the master himself. Excellent ideas. Thanks for Awesome tips Keep it