This is the code repository for the lifesavR
course — a beginners guide to using
R for psychology undergraduates.
- Work on branch
main
(for the moment) - Add .rmd files to
website/
- Use
website/_build.R
to generate html and static files indocs/
(this is published to https://benwhalley.github.io/lifesavR/) - Add .rmd files (lowercase extension)
- Knit them using a setup matching or on the school rstudio server
Use this guide when you're not sure how to create/edit content these materials. If it doesn't answer your question, update this guide with the approach you took.
- use
_first-chunk.R
to load packages and set defaults - use https://styler.r-lib.org/ and https://style.tidyverse.org/ to tidy things (there's an R Studio plugin)
- every
dplyr
verb andggplot
layer must be on a new line - Refer to R Studio elements using matching markup e.g. bold for the Environment pane
- Include empty parentheses for argumentless verbs in pipelines e.g.
gapminder %>% glimpse()
notgapminder %>% glimpse
- All student activities (exercises, MCQs, fill-in-the-blanks ...) should be blocks with
.exercise
class - Use double quotes for string arguments.
To cater for differing student abilities, each level 1 section should have the following format:
- Heading explaining the section content
- Video demonstrating the section content (see session-1.rmd for HTML example of including video)
- A bullet point summary of the key video content (cover/note everything that might be assessed)
- A chunk of code used in video; comments explaining what it does.
- A pseudo-transcript of the video (this may not match word for word what is said, but should cover all points mentioned in the video).
- Each new top level section should be followed by an exercise to reinforce it
- Subsequent exercises should reinforce (only) techniques which have been practiced in previous exercises
- Anything that may needed to be referred to (e.g. exercises, "Check your knowledge" questions) should be numbered sequentially. This makes it easier for staff and students to quickly locate items which require support, especially when this is provided online.
Each worksheet and workbook has a "Check your knowledge" section. Questions test the worksheet content, so the total number will vary. Students are directed to answer these questions in the workbook. The subsequent session begins by revealing the answers to these questions, as a warmup/revision test.
- 'Stage directions' in video transcripts should be included in markdown blocks with a class
.direction
attached. - Be specific about what should be demo'd in the video
- Show rather than tell
- Good: Using variables lets us store calculations for later.
- Bad: It is important to understand what a variable is in R.
- Technical terms
- function not command
- statement not line of code or line, where possible
- column not variable when referring to a column in a dataset
- Spellings
- datasets not data sets
- data types not data-types, or datatypes
- say data frame not
data.frame
unless you really mean 'not a tibble' - built-in not built in/builtin
- x-axis not x axis
- colour not color (in text and
aes()
) - internet not Internet
- RMarkdown not R Markdown