2 Introduction

2.1 Installing R and R Studio

First, you will need to download R if you haven’t already. You can do that at this link: https://www.r-project.org/

Second, you’ll want to download R studio. You can use R without R studio, but you probably don’t want to. R studio is an integrated development environment (IDE; https://en.wikipedia.org/wiki/Integrated_development_environment). R studio can be downloaded at the following link: https://www.rstudio.com/

Okay, that is all you need to start your gloRious adventuRe.

##How do I R?! ### Using RStudio

There are four main panels in the RStudio window.

The top right panel is the workspace. Here you will find a list of all objects currently in memory.

The bottom right window displays files in your working directory, plot output, available packages, and help documentation.

The bottom left panel is the console. You can type code directly into the console and hit enter to execute it.

The top left panel is the code editor. This is where you will write most of your code. In the code editor, you can write multiple lines of code and run chunks or the full script. The toolbar at the top of the panel allows you to interact with the code in the editor in some important ways. Hover your mouse pointer over the icons to see what each button does.

There are also shortcuts that allow you to use the toolbar functions without ever taking your fingers from the keyboard. Here are some of the most commonly used:

Function Keys
Run highlighted code Cmd+Enter
Insert <- option+-
(Un)comment lines Cmd+Shift+C
Knit document Cmd+Shift+K
Run from start to current line Cmd+Option+B
Keyboard shortcut quick reference Option+Shift+K

Another important shortcut is Tab to autocomplete functions or file names.

For a more complete list, check out the RStudio IDE Cheat Sheet. Find it online by going to Help>Cheatsheets>RStudio IDE Cheatsheet, or by clicking the following URL https://www.rstudio.com/wp-content/uploads/2016/01/rstudio-IDE-cheatsheet.pdf

2.2 Getting help

  1. For help with functions, in the console use the ? or ?? before a function name (e.g. ?functionName or ??functionName). The single ? will search for a function of that name whereas ?? will use your input as a keyword to search in all R documentation.
  2. RStudio’s Help. With RStudio open, click on Help in the RStudio toolbar to access some great built in resources. Under help, you’ll find a bunch of useful stuff. Some of the highlights are:
    +RStudio Docs, which will take you to RStudio’s online documentation page where you can likely find answers to many of your questions.
  • Cheatseets. An easy way to access the highly recommended online cheatsheets for:
    • The RStudio IDE
    • dplyr and tidyr
    • ggplot2
    • R Markdown
    • Shiny
    • devtools
  • Keyboard Shortcuts help
  • Markdown Quick Reference
  1. Ask a question on the UO Data Science Club Slack. All you need to join is a UO email address.
  2. Browse the golden nuggets left behind on the old website from when we were the UO R Club. <- good stuff there.
  3. Check out the r-project site for more on help documentation.
  4. Search for answers to your questions on Stack Overflow. It’s likely someone has already asked and answered your question, and if not, you can post it and have a helpful stranger help you in likely very few minutes.If you do ask a question, make sure it’s a good one!
  5. For tidyverse related questions, you may want to check out Hadley Wickham’s “R for Data Science”
  6. Or this online text, “R for beginners”, by Emmanuel Paradis.