Skip to content
R for the Rest of Us Logo

Fundamentals of R

Tips for Working with Quarto

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

View code shown in video
---
title: My Penguins Report!
author: David Keyes
format: html
execute: 
  echo: false
  warning: false
  message: false
---

```{r}
library(tidyverse)
library(scales)

penguins <- read_csv("penguins.csv")
```

### Funders

1.  The **International** Society of Penguin Enthusiasts and Waddle Admirers
2.  The Coalition of People Who Are Definitely Not Anti-Penguin
3.  The International Coalition for the Appreciation and Ethical Treatment of Penguins

They are **very** excited about this report and they *really* hope you are too.

# Introduction

This report is about **three** species of penguins

1.  Adele
2.  Gentoo
3.  Chinstrap

You'll learn *so* much about the penguins. I hope you're ready!

## Results

Here is a chart showing the average bill length for penguins, grouped by island and sex.

```{r}
penguin_bill_length_by_island_and_sex <-
  penguins |>
  drop_na(sex) |>
  group_by(island, sex) |>
  summarize(mean_bill_length = mean(bill_length_mm))

ggplot(
  data = penguin_bill_length_by_island_and_sex,
  mapping = aes(
    x = island,
    y = mean_bill_length,
    fill = sex
  )
) +
  geom_col(position = "dodge")
```


```{r}
penguin_bill_length_by_island <-
  penguins |>
  group_by(island) |>
  summarize(mean_bill_length = mean(bill_length_mm, na.rm = TRUE)) |>
  arrange(mean_bill_length)

penguin_bill_length_by_island_v2 <-
  penguin_bill_length_by_island |>
  mutate(
    mean_bill_length_one_digit = number(
      mean_bill_length,
      accuracy = 0.1
    )
  )

ggplot(
  data = penguin_bill_length_by_island_v2,
  mapping = aes(
    x = island,
    y = mean_bill_length_one_digit,
    fill = island,
    label = mean_bill_length_one_digit
  )
) +
  geom_col() +
  geom_text()
```

Your Turn

  1. Working in your penguins-report.qmd file, add a new code chunk and copy in code to make any graph from the data visualization section of the course.

  2. Render your document and make sure it works.

  3. Adjust your code chunk options so that you do not see your code, any messages, or any warnings in the output (i.e. you should just see the text and charts).

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.