-
Notifications
You must be signed in to change notification settings - Fork 0
Style Guide
Stephan Koenig edited this page Feb 17, 2022
·
1 revision
General:
- In-text blocks, wrap code examples in backticks
`
if no other formatting is available. - Indicate placeholder text that needs to be provided by the user with angular brackets
<placeholder>
, e.g.function(argument = <value>)
.
For R, we follow the tidyverse style guide with the following adjustment:
- Use underscores
_
instead of spaces in file, directory, variable or column names - In R Markdown:
- Use dashes
-
for bullet points. - Use asterisks
*
for *italicized* or **bold**. - In code chunk options:
- Always use spaces around
=
, i.e.=
. - Use dashes instead of spaces for code chunk names (if any).
- The first option after the language option is not separated by a comma
,
, e.g.```{r code-chunk-name, eval = TRUE}
- Always use spaces around
- Use dashes
Most of our teaching material is written in R Markdown using primarily the expanded Markdown syntax (see style guide above for additional conventions) and R code chunks. A great place to start is to follow the introductions to R Markdown and bookdown.
The main product you will work on is the educer package for R. Package development has many tools and covers many different aspects. The most crucial part to get started is setting up your system.
The educer package contains tutorials that use the learnr package.
Design for How People Learn, Second Edition (available on O'Reilly for free via UBC library)
General ideas for exercises:
- Parsons Problem: Users have to put scrambled lines of code in the correct order.
-
Complete code: Provide some or most code, and users need to fill in
<placeholder(s)>
. - Fix the error: Provide a few code lines that do not run and contain one or more errors that users need to correct.
- Provide the output: Provide the final product of code (e.g. a graph) and ask users to write the code to create it.
- Write code from scratch: users need to write all of the code based on a text description.