class: center, middle, inverse, title-slide # 03
computing infrastructure ## 💫 with RStudio Cloud!
🔗
bit.ly/teach-ds-wsc
###
dr. mine çetinkaya-rundel
dr. colin rundel ### 23 june 2021 --- class: middle .pull-left[ .huge-text[Why] ] .pull-right[ .larger[ RStudio in the cloud? ] ] --- .pull-left[ ### lots of friction points - Install R - Install RStudio - Install the following packages: - rmarkdown - tidyverse - ... - Load these packages - Install git ] -- .pull-right[ ### much less friction - Go to rstudio.cloud - Log in ```r >hello R! ``` ] --- .pull-left[ ### go from this <img src="img/jonathan-borba-PZBjJ12Xv2s-unsplash.jpg" title="Students working in a computer lab and instructor helping out." alt="Students working in a computer lab and instructor helping out." width="70%" /> ] -- .pull-right[ ### to this easily <img src="img/sincerely-media-o5Key-1HzaY-unsplash.jpg" title="Student working on their laptop sitting by themselves on the bed, seemingly at home." alt="Student working on their laptop sitting by themselves on the bed, seemingly at home." width="80%" /> ] .footnote[ .tiny[Photos by Jonathan Borba and Sincerely Media on Unsplash.] ] --- class: middle .pull-left[ .huge-text[How] ] .pull-right[ .larger[ RStudio in the cloud? ] ] --- .pull-left[ **RStudio Server Pro** __*__ You have... - sysadmin experience / IT support - hardware / local VM / cloud computing credit - RStudio experience .midi[See [RStudio Academic Pricing](https://rstudio.com/pricing/academic-pricing/), freely licensed for teaching purposes.] ] .pull-right[ **RStudio Cloud** You have... - RStudio experience ] .footnote[ .small[ __*__ Çetinkaya-Rundel, Mine, and Rundel, Colin. "Infrastructure and tools for teaching computing throughout the statistical curriculum." The American Statistician (2018). Part of the Practical Data Science for Stats collection. [[Peer J]](https://peerj.com/preprints/3181/) [[TAS]](https://doi.org/10.1080/00031305.2017.1397549) ] ] --- class: middle .pull-left[ .huge-text[Hello] ] .pull-right[ .larger[ RStudio Cloud ] ] --- ## What is RStudio Cloud? <br> .pull-left-narrow[ <img src="img/cloud.png" title="Illustration of a blue cloud." alt="Illustration of a blue cloud." width="264" /> ] .pull-right-wide[ .large[We created [**RStudio Cloud**](https://rstudio.cloud/) to make it easy for professionals, hobbyists, trainers, teachers, and students to do, share, teach, and learn data science using R.] ] --- class: middle, center <img src="img/rstudio-ide.png" title="Screenshot of the RStudio IDE locally installed on a computer." alt="Screenshot of the RStudio IDE locally installed on a computer." width="100%" /> --- class: middle, center <img src="img/rstudio-cloud.png" title="Screenshot of the RStudio IDE in RStudio Cloud in a browser." alt="Screenshot of the RStudio IDE in RStudio Cloud in a browser." width="100%" /> --- ## Why RStudio Cloud? - Does not require IT support -- - Git works out of the box - Knit to PDF and Word works out of the box -- - Features designed for instructors --- ## Contexts - Shorter workshops: Likely no opportunity to communicate pre-workshop instructions, varied computing background and learning goals - Semester long courses - Intro data science / statistics: little to no background in stats, data science, programming - Upper level data science / statistics: Varied computing background and different computer setups --- ## RStudio Cloud: First look <img src="img/landing-1.png" title="Screenshot of the landing page for RStudio Cloud with no projects." alt="Screenshot of the landing page for RStudio Cloud with no projects." width="80%" style="display: block; margin: auto;" /> --- ## Workspaces - When you create an account on RStudio Cloud you get a workspace of your own - You can add a new workspace and control its permissions - Projects in either workspace can be public or private --- ## A framework for workspaces <img src="img/landing-2.png" title="Screenshot of the landing page for RStudio Cloud with no projects, annotated with additional images. The sidebar is where workspaces are shown has a picture of a classroom and the middle area where projects in the workspace called 'your workspace' has a picture of a sandbox." alt="Screenshot of the landing page for RStudio Cloud with no projects, annotated with additional images. The sidebar is where workspaces are shown has a picture of a classroom and the middle area where projects in the workspace called 'your workspace' has a picture of a sandbox." width="90%" style="display: block; margin: auto;" /> --- ## Projects .pull-left[ A new project in RStudio Cloud <img src="img/new-project-cloud.png" title="Screenshot of RStudio Cloud with the 'New project' button highlighted." alt="Screenshot of RStudio Cloud with the 'New project' button highlighted." width="90%" style="display: block; margin: auto;" /> ] .pull-right[ is a new project in RStudio IDE <img src="img/new-project-local.png" title="Screenshot of RStudio with the 'New project' window overlaid." alt="Screenshot of RStudio with the 'New project' window overlaid." width="90%" style="display: block; margin: auto;" /> ] .alert[ **PSA:** If you use RStudio, use projects! Trust me, you won’t regret it. Find out more on [R for Data Science](https://r4ds.had.co.nz/workflow-projects.html). ] --- ## Projects from Git .pull-left[ A new project from Git repo in RStudio Cloud <img src="img/new-project-git-cloud.png" title="Screenshot of RStudio Cloud with the 'New project from Git' button highlighted." alt="Screenshot of RStudio Cloud with the 'New project from Git' button highlighted." width="90%" style="display: block; margin: auto;" /> ] .pull-right[ is the same as a new project from Git in RStudio IDE <img src="img/new-project-git-local.png" title="Screenshot of RStudio with the 'Create project from version control' window overlaid." alt="Screenshot of RStudio with the 'Create project from version control' window overlaid." width="90%" style="display: block; margin: auto;" /> ] Both options `clone` a Git repo --- ## Sharing options - Option 1: Share a single project - Option 2: Invite users to a workspace (presumably with many projects) --- class: middle # Sharing option .pull-left[ .huge-number[1] ] .pull-right[ .larger[ Single project ] ] --- class: middle .center[ <img src="img/cloud-setup-tweet.png" title="Screenshot of tweet that reads 'Easy peasy, it'll even fit in a tweet: Go to http://rstudio.cloud -> Login -> New Project. Install packages, add scripts, Rmds etc. Gear icon -> Access -> Everyone. Copy URL and share.'" alt="Screenshot of tweet that reads 'Easy peasy, it'll even fit in a tweet: Go to http://rstudio.cloud -> Login -> New Project. Install packages, add scripts, Rmds etc. Gear icon -> Access -> Everyone. Copy URL and share.'" width="80%" style="display: block; margin: auto;" /> ] --- class: middle .center[ .larger[ 👩🏫 teacher ] .larger[ 👩💻 student ] ] --- ## 👩🏫 Creating and sharing a single project <br> .discussion[ **Follow along!** - Create a new project and give it a name - Install a package of your choice - Create a template R Markdown document in the project - Change the access level of the project so others can see it as well - *Optional:* Copy the project URL and share it with the rest of the group in the chat ] --- ## Pros / cons: Sharing a single project .pull-left[ ### Good! - Students land directly in a project upon login - Works well for workshops where all work will be completed in a single project - Also great for sharing code in general, e.g. collaboration, reprexes, etc. ] -- .pull-right[ ### Not so good... - Students need to remember to make a copy of the project (which means you need to remember to remind them!) - You can't keep track which students started their assignment - Students control permissions - You can't easily peek into student projects -- they would need to explicitly share the project with you ] --- class: middle # Sharing option .pull-left[ .huge-number[2] ] .pull-right[ .larger[ Work- space ] ] --- ## 👩🏫 Creating a workspace .center[ <iframe width="896" height="504" src="https://www.youtube.com/embed/tqu1m9R1HLw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> ] --- ## 👩🏫 Workspace membership <img src="img/workspace-members.png" title="Screenshot of the Members tab in an RStudio Cloud workspace. Title on the left area of the window says 'All Members', currently the only member in the workspace is Mine Çetinkaya-Rundel. Title on the left of the window says Options, which lists Access and Permissions options." alt="Screenshot of the Members tab in an RStudio Cloud workspace. Title on the left area of the window says 'All Members', currently the only member in the workspace is Mine Çetinkaya-Rundel. Title on the left of the window says Options, which lists Access and Permissions options." width="70%" style="display: block; margin: auto;" /> --- ## 👩🏫 Role permissions <br> | role | permission | course role | |-------------|--------------------------------------------------|-------------| | admin | manage users, view, edit and manage all projects | instructor | | moderator | view, edit and manage all projects | TA | | contributor | create, edit and manage their own projects | student | | viewer | view projects shared with everyone | auditor | --- ## 👩🏫 Other permissions <br> #### Under the Members tab: .pull-left-narrow[ <img src="img/permissions.png" width="100%" /> ] .pull-right-wide[ - By default, all permissions are turned off - Think carefully before checking these boxes ] --- ## 👩🏫 Options <br> #### Under the Members tab: .pull-left-narrow[ <img src="img/workspace-access.png" width="100%" /> ] .pull-right-wide[ - Make workspace shared for a short period of time, share link with students, enrol them as contributors. - After initial round of enrolment (e.g. drop/add) switch over to this access level - Use invitations for visitors added mid-semester ] --- ## 👩🏫 Inviting a student to a workspace .center[ <img src="img/invite-to-workspace.png" title="Screenshot of the Members tab in an RStudio Cloud workspace. Under Options > Access, Shared is selected. A dropdown menu shows that the initial role of someone who joins the space will be Contributor. Also highlighted is a button that says 'Copy sharing link'." alt="Screenshot of the Members tab in an RStudio Cloud workspace. Under Options > Access, Shared is selected. A dropdown menu shows that the initial role of someone who joins the space will be Contributor. Also highlighted is a button that says 'Copy sharing link'." width="70%" style="display: block; margin: auto;" /> ] --- ## Base projects One of the most attractive features of RStudio Cloud! - Packages you want *installed* on all student projects -- - Text documents you want to appear on **all** student projects (e.g. code of conduct, turn-in instructions, etc.) -- - Applies to all projects created **after** base project has been specified, doesn't apply retroactively -- - Can be updated as many times as you like throughout the course (without having to convince your IT!!!) --- ## 👩🏫 Setting up your base project .center[ <iframe width="896" height="504" src="https://www.youtube.com/embed/Fz9UR6uxAG4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> ] --- ## Git integration 🛑 Only relevant if teaching with Git & GitHub! -- 😁 Base project template can be used, so new project from Git also has the right packages installed! --- ## Pros / cons: Sharing a workspace .pull-left[ ### Good! - Various permission levels - Base projects with desired packages installed - Assignments -- no more "make a copy of the project before starting work" - Peek into students’ projects <img src="img/view-derived-projects.png" title="Screenshot of RStudio Cloud workspace with many shared projects. Highlighted is information on one of these screens that reads 'View 17 derived projects'." alt="Screenshot of RStudio Cloud workspace with many shared projects. Highlighted is information on one of these screens that reads 'View 17 derived projects'." width="80%" style="display: block; margin: auto;" /> ] -- .pull-right[ ### Not so good... - Students land in the workspace, may need to provide instructions for the next steps - Git config for each project can get tedious and doesn't reflect realistic practice ] --- ## Common pitfalls - Changes you make after student launches a project under either model (single project or workspace) won’t propagate to their project -- - Packages in the base project will be **installed** in all projects in the workspace, but not **loaded** - If you need students to run code in the Console that requires a package, your instructions should remind them to load the package first - If using Rmd document, add a `load-package` chunk on top --- ## Feedback / questions / troubleshooting - Check out [status.rstudio.com](https://status.rstudio.com/) - Post on [RStudio Community](https://community.rstudio.com/c/rstudio-cloud) - Email [support@rstudio.cloud](mailto:support@rstudio.cloud) <img src="img/rstudio-cloud-sidebar.png" title="Screenshot of RStudio Cloud workspace, with sidebar items called 'Feedback and Questions' and 'System Status' are highlighted." alt="Screenshot of RStudio Cloud workspace, with sidebar items called 'Feedback and Questions' and 'System Status' are highlighted." width="70%" style="display: block; margin: auto;" /> --- class: middle, inverse # Parting remarks --- ## Tips - Each project is allocated 1GB of RAM (but you can increase this!) - Test things out before assignments involving large datasets - What your students see is not always what you see - Create a secondary account and add as a student --- ## More tips Make brief screencasts for getting students oriented with the platform (especially if remote teaching), or use mine! .center[ [Navigating RStudio Cloud on YouTube](https://www.youtube.com/playlist?list=PLNUVZZ6hfXX05Bs80Hg5MjbOPnEFmwiOM) ] <img src="img/youtube-playlist.png" title="Screenshot of YouTube channel with videos for navigating RStudio Cloud." alt="Screenshot of YouTube channel with videos for navigating RStudio Cloud." width="50%" style="display: block; margin: auto;" /> --- ## More tips .large[ [RStudio Cloud guide](https://rstudio.cloud/learn/guide) ] <iframe width="900" height="450" src="https://rstudio.cloud/learn/guide" frameborder="0" style="background:white;"></iframe> --- ## 📦 rscloud - You can access RStudio Cloud's API to manage space members programatically using the **rscloud** package: - You will need to create client credentials to use the package. You can create credentials at [login.rstudio.cloud/identity](https://login.rstudio.cloud/identity). ```r # install.packages("rscloud") devtools::install_github("rstudio/rscloud") ``` --- ## Pricing .large[ [rstudio.cloud/plans](https://rstudio.cloud/plans) ] <iframe width="900" height="450" src="https://rstudio.cloud/plans/free/" frameborder="0" style="background:white;"></iframe>