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.
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 http://download2.rstudio.org/rstudio-server-0.97.336-i386.deb -O rstudio.deb
On 64-bit Ubuntu, execute the following commands.
wget http://download2.rstudio.org/rstudio-server-0.97.336-amd64.deb -O rstudio.deb
Install the package.
sudo gdebi rstudio.deb
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.
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 from CRAN, the R package repository.
Run the following command inside RStudio to install quantmod.
install.packages("quantmod")
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.
library('quantmod') data <- new.env() getSymbols('AAPL', data) plot(data$AAPL)
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.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This mostly worked. Thanks. However, I had to enable more swap space in order to install packages. I did that by following the advice here:
http://stackoverflow.com/questions/17173972/how-do-you-add-swap-to-an-ec2-instance
Hi, in ubunto 18 and 20 I have:
~# sudo gdebi rstudio.deb Reading package lists… Done Building dependency tree
Reading state information… Done Reading state information… Done This package is uninstallable Dependency is not satisfiable: libssl0.9.8
I followed the instructions and was able to get rstudio working perfectly, however I now have to update R and am unable to change the version of R that is used in rstudio. Anybody know how to do this? I tried changing the value of RSTUDIO_WHICH_R variable and it didn’t work.
Similar issue ‘connection timed out’ If like me you had followed other Digital Ocean tutorials and installed ufw before installing R Studio I hope this solution from askubuntu, which worked for me, will also help you:
I followed these instructions and everything seemed to work. But if I try to run a shiny app or even just access a help page from within R studio I get this error message in the browser window:
This site can’t be reached 127.0.0.1 refused to connect.
Any ideas what is wrong?
Work great but it could be better.
which someone suggested to try a newer version of the rstudio as it is not matched with the R version (which I still cannot remove the error message) but still the sample work great
@daattali I’ve set up ufw and it seems to be blocking me to see a shiny app when i runApp. How to solve this?
Thanks.
I am new to Digital Ocean and Linux, so may have make a rookie mistake.
I have tried all the instructions, and I can log into R, but I cannot access RStudio.
When I type in the ip address:8787 I get an error message “webpage is not available”
What am I doing wrong?
Thanks
This comment has been deleted
I have not been able to connect, I already change the size of the droplet and no change. I try $ sudo rstudio-server verify-installation rstudio-server stop/waiting rstudio-server start/running, process 2258
so everything is ok.
Any thoughts?