library(dplyr)
library(ggplot2)
library(palmerpenguins)
set_blanket()
penguins |>
distinct(species)
penguins |>
bind_each_all(species) |>
distinct(species, each_all)
penguins |>
bind_each_all(species) |>
gg_jitter(
x = species,
y = body_mass_g,
)
penguins |>
bind_each_all(species) |>
gg_jitter(
x = species,
y = body_mass_g,
col = each_all,
col_palette = c(blue, grey),
) +
theme(legend.position = "none")
penguins |>
bind_each_all(species) |>
group_by(species, each_all) |>
summarise(across(body_mass_g, \(x) mean(x, na.rm = TRUE))) |>
gg_col(
x = species,
y = body_mass_g,
col = each_all,
col_palette = c(blue, grey),
width = 0.5,
y_label = "Average body mass g",
) +
theme(legend.position = "none")
penguins |>
bind_each_all(species, all = "All\nspecies") |>
gg_jitter(
x = species,
y = body_mass_g,
col = each_all,
col_palette = c(blue, grey),
facet = each_all,
facet_layout = "grid",
facet_scales = "free_x",
facet_space = "free_x",
) +
theme(legend.position = "none") +
theme(strip.text.x = element_blank()) +
labs(x = NULL)
Run the code above in your browser using DataLab