quarto

Author

Sharav

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(primer.data)
connectedness |> 
  ggplot(aes(x = population, y = connectedness)) +
  geom_jitter(color = 'black', size = 2, alpha = 0.6, width = 0.1, height = 0) +  
  geom_smooth(method = 'loess', color = 'red', fill = 'darkgray', alpha = 0.5) + 
  scale_x_log10(labels = scales::comma_format()) +  
  labs(
    title = "Relationship Between Population and Connectedness",
    subtitle = "Data from primer.data package",
    x = "Population (log scale)",
    y = "Connectedness",
    caption = "Source: primer.data"
  ) 
`geom_smooth()` using formula = 'y ~ x'
Warning: Removed 147 rows containing non-finite outside the scale range
(`stat_smooth()`).
Warning: Removed 147 rows containing missing values or values outside the scale range
(`geom_point()`).