Quarto Documents

Slides

View slides in full screen

Exercises

Exercise 1

  • Open 01-exercise-r.qmd or 01-exercise-py.qmd.
  • Preview/render the document.
    • Posit Cloud: You may be asked to allow pop-ups.
  • Edit the title and preview/render again.

Exercise 2

  • Open 01-exercise-r.qmd and run the first three code chunks (in order).
  • Preview the file.
  • Add a #| include: false chunk option to the second chunk (global-trends). Preview the file and note the differences.
  • In the YAML, add an author field and add your name. Preview the file.
  • Change code-fold to be true. Preview the file.
  • Edit the first paragraph to (1) make something bold by surrounding the text with ** and (2) use inline code instead of hardcoded values for the number of countries. You can use the following code to calculate the number of countries.
length(unique(whr$country_name))
whr['country_name'].nunique()

Exercise 3

  • Add an important callout box to the introduction summarizing the report’s findings.
  • In the first paragraph, link to the World Happiness Report website (https://www.worldhappiness.report/) where it says “2025 World Happiness Report”.
  • Change some text to the color "#eb068c".

Exercise 4

  1. In the workshop repo, there’s a file named 04-exercise.yml. Rename the file to _brand.yml and rerender your Quarto document. What changes?

  2. Change some of the variables in the _brand.yml file and rerender to see how your theme changes. You can reset the file by copying and pasting it from here.

Exercise 5

  1. In the first code chunk of 01-exercise-r.qmd, replace theme_minimal() with theme_brand_ggplot2(). You will need to supply a brand file path ("_brand.yml").

  2. Re-render and see what changes.

  1. In the first code chunk of 01-exercise-python.qmd, add theme_brand_plotnine() right after theme_minimal(). You will need to supply a brand file path ("_brand.yml").

  2. Re-render. Does anything change? What if you change foreground in _brand.yml to hot-pink? Re-render with and without theme_brand_plotnine().

Exercise 6

  1. Read in _brand.yml with read_brand_yml() (R) or Brand.from_yaml() (Python) to a variable named brand.
  2. Change the color of the points and line in the global trends plot to the brand’s teal color. Use code like the following.

(Make sure to first remove #| include: false from the chunk, if it’s still there).

geom_line(color = brand$color$palette$blue)
geom_line(color = brand.color.palette.blue)