With the babies data set in openintro, use a summary table to investigate whether first pregnancy status correlates with gestation length or not. Use pipe operator for your code.

first_preg <- babies %>%
  mutate(first_label = fct_recode(as.factor(parity), "first" = "0", "not first" = "1")) %>%
  group_by(first_label) %>%
  summarise(n = n(), mean_gest = mean(gestation, na.rm = TRUE), median_gest = median(gestation, na.rm = TRUE)) %>%
  print()
## # A tibble: 2 × 4
##   first_label     n mean_gest median_gest
##   <fct>       <int>     <dbl>       <dbl>
## 1 first         921      279.         279
## 2 not first     315      281.         282

The mean gestation lengths for first pregnancies (~279 days) and subsequent pregnancies (~281 days) are nearly identical. Based on this summary table, first pregnancy status does not appear to correlate with gestation length.