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/refs/heads/master/data/caffeinestudy.txt
Load the dataset from https://raw.githubusercontent.com/ndphillips/ThePiratesGuideToR/refs/heads/master/data/caffeinestudy.txt as a new dataframe called
caffeine
.Calculate the mean age for each gender
Calculate the mean age for each drink
Calculate the mean age for each combined level of both gender and drink
Calculate the median score for each age
For men only, calculate the maximum score for each age
Create a dataframe showing, for each level of drink, the mean, median, maximum, and standard deviation of scores.
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.