Summary <- babies %>%
filter(parity == 0, !is.na(gestation), !is.na(weight), !is.na(smoke), !is.na(age)) %>%
select(gestation, age, smoke, weight) %>%
group_by(smoke) %>%
summarise(avg_weight = mean(weight), avg_gestation = mean(gestation), avg_age = mean(age))
show(Summary)
## # A tibble: 2 × 4
## smoke avg_weight avg_gestation avg_age
## <int> <dbl> <dbl> <dbl>
## 1 0 131. 279. 28.8
## 2 1 127. 277. 27.9
Comments: Based on the summary table I have, The first pregnancy status correlates with gestation length.