-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathposit-cloud.qmd
129 lines (102 loc) · 5.77 KB
/
posit-cloud.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Using Posit Cloud {#sec-using-posit-cloud}
```{r}
#| include: false
# To trigger downlit.
```
::: {.callout-note appearance="default"}
Note: RStudio recently changed to Posit, so Posit Cloud (formerly
RStudio Cloud) looks different from the images we show below. However,
the concepts and general orientation are fairly similar.
:::
**Are technical issues with your computer preventing you from completing
the pre-course tasks or doing the course sessions?** A last-ditch
solution may be to use the Posit Cloud platform to do the course. *What
is it?*
Posit Cloud is a cloud computing service hosted by Posit (formerly
called RStudio). It runs allows you to run the RStudio app in your web
browser with full functionality, including built-in integration of R
Projects and Git. It looks slightly different from a local RStudio
session, and it treats R Projects and Git a little different, but the
overall R user experience is virtually identical. For what we need in
this course, we are fine with their free service, which only requires a
little work to register and set up.
## Setting up Posit Cloud
<!-- TODO: Update images to reflect Posit Cloud change. -->
Register a free account: Go to the [Posit Cloud
website](https://posit.cloud/plans/free) and complete the sign-up
process for a free account.
Log in to the account. After logging in, we start on the "Personal
Workspace" page. Here we can create new R Projects (which we'll do
next), set up additional workspaces (which we don't need for this
course) or read the R guides and cheatsheets available in the "Learn"
section of the menu panel (we can explore those after the course,
there's a lot of good content):
![This is Posit Cloud.](images//cloud-start.jpg)
Start a new R Project: Click the "New Project" button. To practice using
it, click the right half of the button and you get the option to create
a project by cloning a GitHub repository (more on that later):
![Create a new Posit Cloud Project.](images//cloud-new-project.jpg)
We'll start a new project from scratch by clicking the button. Don't
forget to click the top panel after the project has been created to
rename it to something sensible. Great! Now we've set up an R Project:
![Our first Posit Cloud project. The interface is identical to a local
instance of RStudio.](images//cloud-project.jpg)
Before we get ahead of ourselves, however, we'll tune the cloud
computing settings for the project to get more monthly run-time out of
our free account.
Throttle CPU and memory usage down: For this course, we don't need a lot
of computer power, so we can get by with just the minimum memory and CPU
settings. With these settings, we get 30 hours of run-time per month,
which should be plenty for this course. To do so, click the gear-icon in
the top right of the screen, then the "Resources" tab, toggle both
sliders to the far left, and click "Apply Changes":
![Tuning cloud resources. Slow and steady wins the
race!](images//cloud-cpu-memory.jpg)
If you end up requiring more memory or CPU power, you can always turn
these settings up later. Cloud run-time is only accumulated while your
project is active, so if you find yourself running low on run-time, make
sure to exit your project when you're not actively coding.
Set up access to GitHub: Finally, we need to allow access to private
GitHub repositories, which we'll be using in this course. Click on your
user name in the top-right corner, and then the "Authentication" tab.
This will take us to the authentication options, where we tick both
boxes at the bottom for enabling GitHub, including the one labeled
"Private repo access also enabled":
![Enable access to private repositories on
GitHub.](images//cloud-settings-github.jpg)
Setting up Git on Posit Cloud projects: Git cannot be set up inside the
project using packages, so `{prodigenr}` and `usethis::use_git()` will
not work. However, it can easily be done through the RStudio menu
interface:
`Tools -> Version Control -> Project Setup -> Version Control System: Git`
Now you're good to go! You should have no issues completing the
pre-course tasks and have a course experience similar to those using a
local installation.
There are just a few more differences between local and Posit Cloud
sessions to be aware of:
- **Uploading files to Posit Cloud projects:** To make files available
to Posit Cloud projects, we have to upload the files to it.
Thankfully, this is very easy! In Posit Cloud, the "Files" tab of
contains a new icon "Upload File", which allows us to easily upload
a file from our local computer (or several files within a zip file)
to the Posit Cloud folder we're currently in:
![Uploading files, e.g. datasets to the cloud is
easy.](images//cloud-upload.jpg)
Another way of loading files to Posit Cloud is to synchronize the
project with a remote repository, which will download all the
tracked files to the Posit Cloud project.
- **R projects and folder structure in Posit Cloud:** Since we start
every R session inside of a project on Posit Cloud, RStudio in the
cloud session doesn't let us set up projects from inside of the R
session. The `{prodigenr}` package can still be used *through the
console* to set up the basic folder structure of our projects.
However, the root folder of any project is fixed to
`/cloud/project/`, so when setting up our folder structure with
`{prodigenr}`, we should have this in mind (e.g.
`prodigenr::setup_project("LearningR")` creates the `{prodigenr}`
folders inside`/cloud/project/LearningR` and avoids unnecessarily
long file paths).
- **Cloning a GitHub remote repository in Posit Cloud:** Can be done
when setting up a new project in the Posit Cloud workspace ("New
Project from Git Repo"), or from the terminal, but it cannot be done
through the RStudio main menu interface.