# load the starbucks nutrition data into the variable starbucks starbucks <- read_csv("starbucks-menu-nutrition-drinks.csv", na = "-") # rename some of the columns starbucks <- starbucks %>% rename( drink = X1, fat = 'Fat (g)', carb = 'Carb. (g)', fiber = 'Fiber (g)' ) # remove all rows with any missing (NA) value starbucks <- na.omit(starbucks) # read in the babies data (used importer with delimiter set to whitespaces # to get this line) babies <- read_table2("babies.csv") # histogram of the mothers' ages hist(babies$age) # Are some motheres very old? No, 99 was used to indicate the mother's age was # missing. You could either get rid of this row or replace 99 with the mean or # median age. # To replace all values of 99 in the age column with the median of the age column: # Store the median age in a variable age_median <- median(babies$age) # Replace any 99 in the age column with this median babies$age[babies$age == 99] <- age_median # Compute the probability of getting 6 successes out of 10 trails, # where the probability of success is 0.75 dbinom(x = 6, size = 10, prob = 0.75)