Global options

  1. Choose “Tools → Global Options…” from the menu.
    • In the dialog, uncheck the fourth checkbox (“Restore .RData into workspace on startup”) and select “Never” in the combobox below (“Save workspace to .RData on exit”).
    • Select “Code” in the list on the left
    • Optionally: Uncheck the third checkbox (“Insert matching parens/quotes”)
    • Select “Saving” in the list on the top
    • Check the two check boxes (“Ensure that source files end with newline”, “Strip trailing horizontal whitespace when saving”)

Projects (not in rstudio.cloud)

  1. Choose “File → New Project… → New Directory → New Project” from the menu.

  2. Type a name for your new directory, and choose a directory on your local or network drive.

  3. OK.

  4. Close and reopen RStudio. Double-check that the project is still active.

  5. Type and run getwd() in the console, double-check that the output matches the path to your newly created directory.

  6. Open the project you started with today by selecting it from the project dropdown in the top right corner of the RStudio IDE window. (Alternatively, close the RStudio IDE and double-click the R-workshop.Rproj file.)

Scripts in a new session

  1. Restart the R session (via “Session → Restart R” or via Ctrl + Shift + F10, on the Mac: Cmd + Shift + F10).

    Hint: The keyboard shortcut may not work in rstudio.cloud.

  2. Source the script you have edited last. Remember the first line of each script should be library(tidyverse).

    Hint: The keyboard shortcut may not work in rstudio.cloud.

  3. Choose “File → Knit document” to render the entire output to a single document.

  4. Everything after # is a comment. Add a regular comment and one prefixed with #' (hash apostroph). Knit the document. Can you see the difference?

  5. View the mpg dataset with View(mpg). Experiment with the data viewer.

Copyright © 2018 Kirill Müller. Licensed under CC BY-NC 4.0.