data <- read_csv("../00_data/survivalists.csv")
## Rows: 94 Columns: 16
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (10): name, gender, city, state, country, reason_tapped_out, reason_cate...
## dbl (5): season, age, result, days_lasted, day_linked_up
## lgl (1): medically_evacuated
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
data_by_season <- data %>%
group_by(season) %>%
summarise(
avg_season = mean(season, na.rm = TRUE)
)
data_by_season
## # A tibble: 9 × 2
## season avg_season
## <dbl> <dbl>
## 1 1 1
## 2 2 2
## 3 3 3
## 4 4 4
## 5 5 5
## 6 6 6
## 7 7 7
## 8 8 8
## 9 9 9
# Plot
data %>%
ggplot(aes((x = season = mean(days_lasted, na.rm = TRUE)), y = days_lasted)) +
geom_point()
Make two bar charts here - one before ordering another after
data %>%
ggplot(aes(x = days_lasted, y = fct_reorder(.f = reason_tapped_out, .x = days_lasted))) +
geom_point() +
# Labeling
labs(y = NULL, x = "Mean days lasted")
Show examples of three functions:
data %>%
transmute("days_lasted") %>%
ggplot(aes(x = "season", y = 100))
No need to do anything here.