10.6 Test your R might!: Mmmmm…caffeine

You’re in charge of analyzing the results of an experiment testing the effects of different forms of caffeine on a measure of performance. In the experiment, 100 participants were given either Green tea or coffee, in doses of either 1 or 5 servings. They then performed a cognitive test where higher scores indicate better performance.

The data are stored in a tab–delimited dataframe at the following link: https://raw.githubusercontent.com/ndphillips/ThePiratesGuideToR/master/data/caffeinestudy.txt

  1. Load the dataset from https://raw.githubusercontent.com/ndphillips/ThePiratesGuideToR/master/data/caffeinestudy.txt as a new dataframe called caffeine.

  2. Calculate the mean age for each gender

  3. Calculate the mean age for each drink

  4. Calculate the mean age for each combined level of both gender and drink

  5. Calculate the median score for each age

  6. For men only, calculate the maximum score for each age

  7. Create a dataframe showing, for each level of drink, the mean, median, maximum, and standard deviation of scores.

  8. Only for females above the age of 20, create a table showing, for each combined level of drink and cups, the mean, median, maximum, and standard deviation of scores. Also include a column showing how many people were in each group.