generated from allisonhorst/meds-distill-template
-
Notifications
You must be signed in to change notification settings - Fork 10
/
day2-rstudio_server.qmd
73 lines (43 loc) · 3.63 KB
/
day2-rstudio_server.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
title: "RStudio server"
---
# RStudio Server
From an user perspective, _RStudio Server is your familiar RStudio interface in your web browser_. The big difference however is that with RStudio Server the computation will be running on the remote machine instead of your local personal computer. This also means that **the files you are seeing through the RStudio Server interface are located on the remote machine. And this also include your R packages!!!** This remote file management is the main change you will have to adopt in your workflow.
To help with remote files management, the RStudio Server interface as few additional features that we will be discussing in the following sections.
```{r RStudio Server, echo=FALSE, out.width='90%', fig.align="center"}
knitr::include_graphics("img/rstudio-server-ide.png")
```
## Connecting to MEDS Analytical Server
1. Got to: <https://workbench-1.bren.ucsb.edu/>
2. Enter your credentials
3. You are in!
```{r echo=FALSE}
knitr::include_graphics("img/rstudio-server_login.png")
```
4. Click on the `New Session` button. You can see that you are able to start both an R (Studio) and jupyter notebook session. Let's take a few minutes to experiment with the different options.
For this session, we are going to select the `RStudio` option and hit `Start Session`.
```{r echo=FALSE}
knitr::include_graphics("img/rstudio-server_session.png")
```
**You should now see a very familiar interface :) Except it is running on the server with a lot of resources at your fingertips!!**
### File structure
Let's explore explore a little bit the file structure on the server. By default on a Linux server, you are located in the `home` folder. This folder is only accessible to you and it is where you can store your personal files on a server. You should see 2 folders: `R` and `H`
```{r echo=FALSE}
knitr::include_graphics("img/rstudio-server_file-structure.png")
```
The `R` folder is where your local R packages will be installed, you can ignore it. The `H` is your H drive that the Bren School is offering to all its students. If you click on it you should see any files you have uploaded there.
Let us make a folder named `github` by click on the `New Folder` button at the top of the tab. We will use this folder (also named `directory` in linux/unix terms) to clone any GitHub repository.
### R packages
If we go to the `Packages` tab, we can see a long list of packages that have already be installed by our system administrator (Brad). Those packages have been installed server wide, meaning that all the users have access to them.
```{r echo=FALSE}
knitr::include_graphics("img/rstudio-server_packages.png")
```
A user can also installed her/his own packages. Let's try to install the `remote` package that lets you install R packages directly from GitHub: `install.packages("remotes")`. Once done, note a new section that appeared on the Packages tab named `User Library`. Each of us have now its own copy of the package installed (in this `R` folder we were talking about a few minutes ago).
```{r echo=FALSE}
knitr::include_graphics("img/rstudio-server_packages-user.png")
```
A few notes:
- In this example we will have made a better choice to have the `remotes` package installed once at the system level
- Some R packages depend on external libraries that need to be installed on the server. Those libraries will have to be installed by the system administrator first before you can install the R package
- Installing an R package on a linux machine generally requires compilation of the code and will thus take more time to install than when you install it from pre-compiled binaries
**Look now inside you `R` folder!!**