Week 2: Introduction to R

R Statistical Software is the environment in which you will do the vast majority of your data analysis. It allows you to work with data, run analyses, make figures, and more. To be an effective fisheries scientist, you will need to build a working knowledge of this. It’s a steep learning curve, but the payoff is tremendous.

We’re going to start from the beginning in this course, and build from there. This week we will become acquainted with the R environment and do some initial coding.

Lecture Topics

  • The philosophy of R
    • Reproducible code
    • R as a calculator
    • R as a language
    • Infinite expansion via packages
  • R makes hard things easy…
    • … but without training easy things can be hard
  • Intro to R syntax
  • How to ask good questions

In-class Activities

  • R Basics
    • Calculations
    • Variables
    • Importing data and basic operations
    • Comments
    • Organizing code into scripts
    • Activating and using packages

Resources

There are many resources online that will help you learn R. If video-based learning is your thing, I suggest Datacamp: https://www.datacamp.com/courses/free-introduction-to-r

If you prefer giant (surprisingly readable) manuals, I recommend:

Crawley, M.J. (2012). The R Book, 2nd Edition. Wiley, p. 1076. ISBN: 978-0-470-97392-9.

This manual is stripped down and focused more on the R mechanics than statistical analysis:

Wickham, Hadley and Garrett Grolemund (2017). R for data science: visualize, model, transform, tidy, and import data. O’Reilly Media, p. 518. ISBN: 978-1491910399. http://r4ds.had.co.nz/index.html.

Details - Week 2

Activity

Students will do some basic stuff in R. By the end of the workshop they should complete:

  • Calculations
  • Importing data and basic operations
  • Comments
  • Activating and using packages
  • Organizing code into scripts
  • Comparing R to RStudio

Code and Data

Lecture Slides

Slides available via speakerdeck