2+2[1] 4
sqrt(64)[1] 8
Get up and running with RStudio in the cloud
bit.ly/positlogin into the address bar) to create an account at posit.cloud, using the ‘don’t have an account? Sign up’ box. It’ll ask you to check your email for a verification link so do that before proceeding.
You should now have RStudio open in your posit.cloud account…
It should look something like the pic below.

RStudio is where you’ll be doing all the R loveliness.
Before looking at RStudio in more detail, let’s make a new R script, where you’ll do most of your coding.
Task: Open a new R script in RStudio

After that new file’s been made, the script will be open in RStudio, top left (see pic).
The console is bottom left: all R commands end up being run here. You either run code directly in the console or send code from your R script.
Task: enter some commands directly into the console
Click in the console area so the cursor is on the command line. Type some random sums (or copy, see next slide) - press enter and you’ll see the results directly in the console.
Note that second one: sqrt is a function and arguments go into the brackets. More on that in a mo.
Copying code from these slides into RStudio
We can assign all manner of things a name to then use them elsewhere: values, strings, lists - and, crucially, data objects like all the UK’s regional GVA. But these all use the same method.
We’ll now stick some code into that newly created R script we made earlier in the top left of RStudio.
All code will run in the console - what we do with scripts is just send our written/saved code to the console.
Let’s test this by adding code to load the tidyverse library.
What’s the tidyverse?
It’s a basket of tools that have become part of the R language - they all fit together to make consistent workflows much easier.
The online book R for Data Science is a great source to learn it, by the person who started it.
Task: add a line of code to the R script
Type or paste the following text at the top of the newly opened R script in the top left panel.
When you’ve put that in, the script title will go red, showing it can now be saved (it should look something like the image below).

Task: Run the library(tidyverse) line
Now we need to actually run that line of code… we can do this in a couple of ways:
Let’s do #1: Run the code line by line.
libary(tidyverse) line in the script (if it’s not there already), either with the mouse or keyboard. (Keyboard navigation is mostly the same as any other text editor like Word, but here’s a full shortcut list if useful.)If all is well, you should see the text below in the console - the tidyverse library is now loaded. Huzzah!

Task: Go to the github page where the code lives





Onto more R goodness!
Let me know if anything doesn’t work or doesn’t make sense - d dot olner at sheffield dot ac dot uk