ucdavisdatalab / workshop_intermediate_r

Reader for the Intermediate R workshop series.
https://ucdavisdatalab.github.io/workshop_intermediate_r/
Other
2 stars 4 forks source link
data-science r teaching-materials ucdavis ucdavis-datalab workshop

Workshop: Intermediate R

UC Davis DataLab
Winter 2024
Instructors: Nick Ulle, Wesley Brooks
Maintainer: Nick Ulle <naulle@ucdavis.edu>

This is the reader for all of UC Davis DataLab's Intermediate R workshop series. The reader currently has four parts:

  1. Cleaning & Reshaping Data

  2. Writing & Debugging R Code

  3. Data Visualization & Analysis in R

  4. Thinking in R, which is about understanding how R works, how to diagnose and fix bugs in code, and how to estimate and measure performance characteristics of code.

Each part is independent and consists of approximately 2 workshop sessions.

Contributing

The course reader is a live webpage, hosted through GitHub, where you can enter curriculum content and post it to a public-facing site for learners.

To make alterations to the reader:

  1. Run git pull, or if it's your first time contributing, see Setup.

  2. Edit an existing chapter file or create a new one. Chapter files are R Markdown files (.Rmd) at the top level of the repo. Enter your text, code, and other information directly into the file. Make sure your file:

    • Follows the naming scheme ##_topic-of-chapter.Rmd (the only exception is index.Rmd, which contains the reader's front page).
    • Begins with a first-level header (like # This). This will be the title of your chapter. Subsequent section headers should be second-level headers (like ## This) or below.
    • Uses caching for resource-intensive code (see Caching).

    Put any supporting resources in data/ or img/. For large files, see Large Files. You do not need to add resources generated by your R code (such as plots). The knit step saves these in docs/ automatically.

  3. Run knit.R to regenerate the HTML files in the docs/. You can do this in the shell with ./knit.R or in R with source("knit.R").

  4. Run renv::snapshot() in an R session at the top level of the repo to automatically add any packages your code uses to the project package library.

  5. When you're finished, git add:

    • Any files you added or edited directly, including in data/ and img/
    • docs/ (all of it)
    • _bookdown_files/ (contains the knitr cache)
    • renv.lock (contains the renv package list)

      R Packages

      This repo uses renv for package management. Install renv according to the installation instructions on their website.

      Then open an R session at the top level of the repo and run:

      renv::restore()

      This will download and install the correct versions of all the required packages to renv's package library. This is separate from your global R package library and will not interfere with other versions of packages you have installed.

      Back to Top