library(tidyverse)
#> Warning: package 'ggplot2' was built under R version 4.3.1
#> Warning: package 'purrr' was built under R version 4.3.1
#> Warning: package 'dplyr' was built under R version 4.3.1
#> Warning: package 'lubridate' was built under R version 4.3.1
library(palmerpenguins)
p <- penguins |>
tidyr::drop_na(sex) |>
ggplot() +
geom_histogram(aes(x = flipper_length_mm), stat = "bin")
suppressMessages(p)
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
library(ggplot2)
library(palmerpenguins)
p <- penguins |>
tidyr::drop_na(sex) |>
ggplot(aes(x = flipper_length_mm)) +
geom_histogram(binwidth = 5)
p
Per the help page, the message is didactic, because
The [binwidth] default is to use the number of bins in bins [which is NULL], covering the range of the data. You should always override this value, exploring multiple widths to find the best to illustrate the stories in your data.