library(tidyverse)

data import

Running this script will import the datasets you need

source(here::here("code", "healthcare.R"))

take a glimpse at the heart_joined dataset to look for the variables we'll be searching within

glimpse(heart_joined)

How many people having an "auntie" or "aunt" in their health history?

sum(str_count(heart_joined$family_history, "unt"))

how many people have Mother/mother but not grandmothers in their family history?

sum(str_count(heart_joined$family_history, "^(M|m)other"))

Beginning with heart_joined, create a new column called statin that detects whether or not a patient is on a statin, "and then" filter the dataset to contain only this subgroup of people. Call this new dataframe statin_subgroup

How many people are in this subgroup?

statin_subgroup <- heart_joined %>% 
  mutate(statin = str_detect(medication_hx, "statin")) %>% 
  filter(statin == TRUE)

#391 people


BAREJAA/reactivity documentation built on April 16, 2020, 6:57 p.m.