The unilur tutorial formats

To start writing your first practical for students, create a new Rmarkdown file using the template provided by unilur. The yaml header will contain the following output formats:

output:
  unilur::tutorial_html: default
  unilur::tutorial_pdf: default
  unilur::tutorial_html_solution: default
  unilur::tutorial_pdf_solution: default

Use the Rstudio dropdown knit button to render the desired file. To allow the creation of two distinct files (with and without solutions) from a single Rmarkdown file, the output file will end with a suffix which can be adjusted in the YAML header.

The default values of the suffix argument are:

Solutions

Answers or solutions are written within a code chunk with the solution = TRUE option. The content of these chunks will be wrapped within a green box (read the custom boxes article to change the appearance).

For example, if you write the following question and supply the solution = TRUE option chunk to the answer:

- What is the mean speed reported in the `cars` dataset?

```{r, solution = TRUE}
mean(cars$speed)
```

You will generate the following output using the unilur::tutorial_html_solution format:

  • What is the mean speed reported in the cars dataset?

If you render the same file using unilur::tutorial_html, the green box containing your expected answer will not appear.

Advice

To highlight some content, you can also include it in custom boxes: have a look at the dedicated article to learn how to create them.