Download the .zip
file for the test project from https://github.com/krlmlr/vistransrep-proj, green button “Clone or download”.
Extract the .zip
file to your disk.
Locate and open the file R-workshop.Rproj
.
Open the file 01-hello.R
in the scripts
directory. Run it line by line by positioning the blinking cursor (caret) in the first line and pressing Ctrl + Enter (on the Mac: Cmd + Enter). Also, run it completely (press Ctrl + Shift + Enter, on the Mac: Cmd + Shift + Enter).
Open the file 02-calc.R
. Run it line by line.
Practice the “clean slate”: Activate the console (Ctrl + 2, on the Mac Cmd + 2), press Esc twice, click the broom in the upper right corner of the console (or press Ctrl + L, also on the Mac). Make sure that the console shows a single blue >
only.
Open the file 03-incomplete.R
in the scripts
directory. Run it completely (click the “Source” button, or press Ctrl + Shift + Enter). Can you see the problem?
Hint: Apply the “clean slate” practiced before.
From a “clean slate”, run the first line in 03-incomplete.R
. How do you return to a state where R accepts your commands again?
Edit the file so that it can be run completely.
Open the file 04-error.R
in the scripts
directory. Run the first line of the script. Can you interpret the error?
Hint: Apply the “clean slate” practiced before.
Open the file 05-multiline.R
. Position the blinking cursor (caret) on the second line of the script, press Ctrl + Enter (on the Mac, Cmd + Enter). Can you give an interpretation for the observed behavior?
Open the file 06-premature.R
. Run it line by line or completely. Can you give an interpretation for the observed behavior?
Open and run the script 07-help.R
.
mpg
geom_boxplot()
near()
Hint: Position the caret on the name you want to look up the help for, and press F1.
Look up the help for the %/%
operator.
Hint: Type help("%/%")
in your script and run the line with Ctrl + Enter (on the Mac, Cmd + Enter)
Visit https://rdrr.io or https://rdocumentation.org, search for functions and objects from this exercise.
Use the search term geom_boxplot site:tidyverse.org
in a search engine.
Choose “File → New file → R script” to create a new script.
Save it in the scripts
directory, pick a file name (recommended: 08-new
). The extension .R
will be added automatically.
Add code to load the tidyverse package on the first line. Save the script.
Copyright © 2018 Kirill Müller. Licensed under CC BY-NC 4.0.