5^7[1] 78125
# Or, another way of writing this:
5**7[1] 78125
This practical introduces the basics of using RStudio Desktop1, including navigating its interface and using keyboard shortcuts.
We’ll experiment using R as a calculator, explore built-in functions and arguments, and create and manipulate objects in R.
We’ll introduce common object types (e.g., vectors) and functions like str and typeof to query the structure and type of an object.
You may want to refer to the RStudio cheatsheet during this practical.
Open RStudio on your computer2.
Open a new script editor within RStudio.
Practice using keyboard shortcuts:
Switch between the console and script editor with Ctrl + 1 and Ctrl + 2.
Scroll through the console history with ↑ and ↓.
Search the console history with Ctrl + r.
Clear the console screen with Ctrl + l.
(Optional) Pick a colour scheme in the settings.
Review the RStudio cheatsheet. What is the keyboard shortcut to comment (and uncomment) the selected text?
Type at the console to answer the following questions.
Check the help for the fivenum function.
What does the na.rm argument do?
How can you calculate the modulo of two numbers?
The modulo is the remainder after division of one number by another; see here for details. You may need to search online to answer this question.
paste command to concatenate these objects.radius that contains the value 5.str and typeof to check the structure and types of the objects you just created.rm or via the RStudio “Environment” pane.1 to 5;a, b, c, d, e;Use the functions c, seq, rnorm(5).
a and b, each containing 10 random numbers (using rnorm).a to the corresponding value of b, creating a new vector of length 10.5 to each value of a.Referred to as ‘RStudio’ from herein.↩︎
If you’re having problems installing R, you can use the online RStudio server provided by posit.↩︎