R in 3 Months Week 4 (Quarto)

What is one way that you can see yourself using Quarto in your work?

Put your answer in the chat!

Agenda

  1. Housekeeping

  2. Data Wrangling and Data Viz Questions

  3. Project Examples

  4. Quarto Exercise

  5. Quarto Tips

  6. Next Week

Housekeeping

  1. Next week is a catch-up week: no live session or co-working session

Questions on Data Wrangling or Data Viz?

When is data real?

I would like you to help me confirm that once an Object appears in the Environment Panel, it’s automatically saved. In this case our object is penguins.

When is data real?

Source: rstats.wtf

Project Examples

Quarto

Quarto Exercise

Quarto Exercise

  1. Copy the code from this Quarto document. Figure out why it won’t render and change it so that it will!

  2. Copy the code from this second Quarto document. There are a series of questions in it. Tackle them one by one, making changes to the document as you do so.

Quarto Tips

Markdown Text Shows Up in Many Places!

  1. Lesson comments

Visual Editor

Indented Lists

How do you add subitems in lists? I tried my best but I am not liking how my subitems show up as a dash.

  1. List item

  2. Indented list item

  • List item

    • Indented list item

How to structure your Quarto documents

  1. Load packages at top

  2. Import data at top

  3. Custom functions at top

  4. Code chunks used throughout to make outputs (graphs, tables, maps, etc)

  5. I also do data cleaning/tidying in a separate R script file (you’ll learn about this soon)

How I use Quarto documents is not how you have to use Quarto documents!

So, is the purpose of Quarto primarily for data viz? It isn’t something that for example you’d use for summary stats unless have some visual component with it?

Many people do data cleaning and exploratory data analysis in Quarto documents!

How to change the size of plots in Quarto documents

penguins |>
  count(island) |>
  ggplot(aes(x = island, y = n)) +
  geom_col()

How to change the size of plots in Quarto documents

```{r}
#| echo: true
#| fig-height: 1
penguins |> 
  count(island) |> 
  ggplot(aes(x = island, 
             y = n)) +
  geom_col()
```

How to change the size of plots in Quarto documents

penguins |>
  count(island) |>
  ggplot(aes(x = island, y = n)) +
  geom_col()

How to make multi-column layouts in Quarto documents

Column 1

Column 2

How to make multi-column layouts in Quarto documents

:::: {.columns}

::: {.column width="50%"}
Column 1
:::

::: {.column width="50%"}
Column 2
:::

::::

How to change the look and feel of Quarto documents

General Tip

How to Make Sense of R Help Docs

I looked into the geomtextpath package and even found a fairly helpful guide (https://cran.r-project.org/web/packages/geomtextpath/vignettes/geomtextpath.html) but I’m still at a loss on how to incorporate the names into the lines themselves. I wish I were better at understanding the Help guides.

Any Other Quarto Questions?

Next Week

  • Catch-up week! No live session or co-working sessions are happening, but please reach out to Gracielle for any help you may need!

  • For following week, you will be learning about advanced data wrangling, focusing on the concept of tidy data. Lessons are up now so you can start whenever you would like to!