Using R

Using RStudio

Faculty makes data science in R easy by allowing you to easily use RStudio, one of the best development environments for R.

To start using R on Faculty, start a server and select R Studio under server type:

../_images/start_rstudio_server.png

Once your server is up and running, simply click on the name of the server to open it in your workspace. Faculty uses RStudio server, which provides almost all of the functionality of RStudio installed on your desktop machine.

To install packages such as tidygraph, simply open your RStudio server and run:

install.packages('tidygraph')

Plots are displayed in RStudio’s plot viewer:

library(ggplot2)
ggplot(data=iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) +
  geom_point(size=3)

Installing packages via Faculty Environments

To install R packages in a reproducible way you can use the Faculty Environments feature.

For example, to install the tidygraph and shinydashboard packages enter the following code snippet into the bash script section of any Faculty Environment

R -e "withCallingHandlers(install.packages(c('tidygraph', 'shinydashboard'), repos='https://cran.rstudio.com/'), warning=function(w) stop(w))"

The withCallingHandlers function call ensures that if there are errors whilst installing the packages the environment application will fail.

To find out more about Faculty features for your R workflow, take a look at these pages: