Caffeine has long reigned as the most popular method of enhancing both cognitive and physical performance; indeed, it’s the most widely consumed psychoactive stimulant in the world (Frary et al., 2005). Yet with the rise in what researchers are calling the ‘mental health crisis’ (Moore, 2019), it’s time to investigate the association between caffeine consumption and mental health.
“Caffeine consumption and self-assessed stress, anxiety, and depression in secondary school children”
Richards, G., & Smith, A. (2015). Caffeine consumption and self-assessed stress, anxiety, and depression in secondary school children. Journal Of Psychopharmacology, 29(12), 1236-1247. doi: 10.1177/0269881115612404
1. Is there an underlying link between caffeine consumption levels and self-reported levels of anxiety, depression and stress?
2. Does this report differ between caffeinated drink types?
# Load Packages
library(rmarkdown)
library(tinytex)
library(ggplot2)
library(readr)`
`# load Data
read.csv(~Desktop/Coding_Project/full_set.csv)
read.csv(~Desktop/Coding_Project/Anxiety.csv)
read.csv(~Desktop/Coding_Project/dep_ad.csv)
read.csv(~Desktop/Coding_Project/Strs.csv)
read.csv(~Desktop/Coding_Project/ed_allcond.csv)
read.csv(~Desktop/Coding_Project/cola_allcond.csv)
read.csv(~Desktop/Coding_Project/coffee_allcond.csv)
read.csv(~Desktop/Coding_Project/tea_allcond.csv)`
`# Tidying the Data, changing name and removing unnecessary variables
TAC <- read_csv("coding_project/tea_allcond.csv", col_types = cols(`Drink type` = col_skip()))`
print(TAC)
# A tibble: 12 x 4
`Caffeine Intake from Tea` `Self-Reported Mental Health Level` `Number of people` Condition
<chr> <chr> <dbl> <chr>
1 Low/ Medum Low 227 Stress
2 High Low 248 Stress
3 Low/ Medum High 367 Stress
4 High High 457 Stress
5 Low/ Medum Low 352 Anxiety
6 High Low 394 Anxiety
7 Low/ Medum High 239 Anxiety
8 High High 310 Anxiety
9 Low/ Medum Low 369 Depression
10 High Low 460 Depression
11 Low/ Medum High 220 Depression
12 High High 243 Depression
library(ggplot2)
ggplot(FULL_SET, aes(x= `Mental Health Level`, y= `Number of people` , color= `Caffeine Intake`, fill = Condition)) +
geom_bar(stat = "identity", position = "dodge")+
facet_grid(. ~ `Drink type`)
#color changes the outline of the bar
#fill changes the colour of the bar - this allows you to see the effect of extra variables,
#facet_grid allows you to organise the data into more helpful groups
#postion "dodge" means that the bars won't stack on top of eachother, making them easier to interpret.
BCFS<-ggplot(FULL_SET, aes(x= `Mental Health Level`, y= `Number of people` , color= `Caffeine Intake`, fill = Condition)) +
geom_bar(stat = "identity", position = "dodge")+
facet_grid(. ~ `Drink type`) #change directory name
#save output
ggsave('FULLBAR.jpg')
ggplot(FULL_SET, aes(x= `Mental Health Level`, y= `Number of people`, shape = `Drink type`, color = `Caffeine Intake`))+ geom_point(stat = 'identity', width = 1, position = "dodge")+ facet_grid(. ~ Condition)
TAC<- tea_allcond
ggplot(TAC , aes(x= `Self-Reported Mental Health Level`, y= `Number of people`, fill= `Caffeine Intake from Tea`)) +
geom_bar(stat = "identity", position = "dodge") +
facet_grid(. ~ Condition)
## Visualisation 3 – The effect of Caffeine Intake on Stress, Anxiety, Depression Independently by Drink Type
`ggplot(Strs, aes(x= `Self-Reported Stress Level`, y= `Number of people`, fill= `Caffeine Intake`)) +
geom_bar(stat = "identity", position = "dodge") +
facet_grid(. ~ `Drink type`)
col="#69b3a2" #change the colour of the box plot filling
ggplot(full_set, aes(x= `Drink type`, y = `Number of people`)) + geom_boxplot(fill=col)
library(plotrix)
slices <- c(2675, 4340, 1891, 3886) #creating the variables needed for the data
lbls <- c("Energy drink", "Cola", "Coffee", "Tea") + pie3D(slices,labels=lbls,explode=0.1, main="Pie Chart of Drink Popularity")
library(dplyr)
library(forcats)
ggplot(full_set, aes(x= `Mental Health Level`, y=`Number of people`, fill = Condition)) +
geom_bar(stat = "identity", width=0.8, position = "dodge") +
coord_flip()
fill <- "gold1"
line <- "goldenrod2"
ggplot(Anxiety, aes(x= `Self-Reported Anxiety Level`, y = `Number of people`)) + geom_boxplot(fill = fill, colour = line)
## Average Stress Level with White Box Plot
ggplot(Strs, aes(x= `Self-Reported Stress Level`, y = `Number of people`)) + geom_boxplot()
fill <- "#4271AE" #adding different colours and lines
line <- "#1F3552"
ggplot(dep_ad, aes(x= `Self-Reported Depression Level`, y = `Number of people`)) + geom_boxplot(fill = fill, colour = line)
slicess<-c(670, 2614, 1371, 723, 369, 697)
lblss<-c("0 mg/w", "0.1–250 mg/w", "250.1–500 mg/w", "500.1–750 mg/w", "750.1–1000 mg/w", ">1000 mg/w")
pie3D(slicess,labels= lblss ,explode=0.001, labelcex = 0.75, height = 0.25, main="Pie Chart of Average Weekly Caffeine Intake") #altering the height of the pie chart, the size of the text and the shape to make the chart easier to read
*1: Graphing uses only uses data from high school students. The generalisability and reliability of results would be improved by the use of a more representative group of participants. This would include members of different age groups and occupations.*
*2: No caffeine intake category was excluded as the data provided many outliers.*
*3: Caffeine intake seemed to have the strongest association with Stress, with higher intake correlating to greater stress levels.*
*4: Coffee had the weakest effect on mental health levels compared to the other drink types.*
*5: Cola was the most popular drink choice, and the most popular weekly caffeine consumption 0-250mg.*
*6: High Stress levels were voted as most common mental health concern, with depression scoring least.*
Future research should focus on analysing a wider data pool, including people of different ages and occupations.
##References
Richards, G., & Smith, A. (2015). Caffeine consumption and self-assessed stress, anxiety, and depression in secondary school children. Journal Of Psychopharmacology, 29(12), 1236-1247. doi: 10.1177/0269881115612404
Frary CD, Johnson RK, Wang MQ (2005) Food sources and intakes of caffeine in the diets of persons in the United States. J Am Diet Assoc 105:110–113
Moore, S. (2020). We are in the midst of a mental health crisis. The Guardian. Retrieved from https://www.theguardian.com/commentisfree/2019/oct/07/we-are-in-the-midst-of-a-mental-health-crisis-advice-about-jogging-and-self-care-is-not-enough