mdsr-book / mdsr

Complement to CRC Press book *Modern Data Science with R*
38 stars 25 forks source link

add BP_narrow and BP_wide to package? #60

Open nicholasjhorton opened 3 years ago

nicholasjhorton commented 3 years ago
BP_full <- readr::read_delim("data/BP_narrow.csv", delim = "|")
BP_narrow <- BP_full %>%
  distinct(subject, when, .keep_all = TRUE) %>%
  select(subject, when, sbp) %>%
  arrange(desc(when), subject)
BP_wide <- BP_narrow %>%
  pivot_wider(names_from = when, values_from = sbp) %>%
  select(subject, before, after)