<!-- rnb-source-begin eyJkYXRhIjoiYGBgclxubGlicmFyeShnZ3Bsb3QyKVxubGlicmFyeShHR2FsbHkpXG5saWJyYXJ5KHRpZHl2ZXJzZSlcbmxpYnJhcnkobGF0dGljZSlcbmBgYCJ9 -->
```r
library(ggplot2)
library(GGally)
library(tidyverse)
library(lattice)
```
<!-- rnb-source-end -->
```r
library(ggplot2)
library(GGally)
library(tidyverse)
library(lattice)
<!-- rnb-source-end -->
<!-- rnb-output-end -->
<!-- rnb-chunk-end -->
<!-- rnb-text-begin -->
<!-- rnb-text-end -->
<!-- rnb-chunk-begin -->
<!-- rnb-output-begin eyJkYXRhIjoiXG48IS0tIHJuYi1zb3VyY2UtYmVnaW4gZXlKa1lYUmhJam9pWUdCZ2NseHVjM1Z0YldGeWVTaFRiMk5wWVd4ZlRXVmthV0ZmUVdSa2FXTjBhVzl1S1Z4dVlHQmdJbjA9IC0tPlxuXG5gYGByXG5zdW1tYXJ5KFNvY2lhbF9NZWRpYV9BZGRpY3Rpb24pXG5gYGBcblxuPCEtLSBybmItc291cmNlLWVuZCAtLT5cbiJ9 -->
<!-- rnb-source-begin eyJkYXRhIjoiYGBgclxuc3VtbWFyeShTb2NpYWxfTWVkaWFfQWRkaWN0aW9uKVxuYGBgIn0= -->
```r
summary(Social_Media_Addiction)
Age Gender Academic_Level Country Daily_Hours
Min. :18.00 Length:705 Length:705 Length:705 Min. :1.500
1st Qu.:19.00 Class :character Class :character Class :character 1st Qu.:4.100
Median :21.00 Mode :character Mode :character Mode :character Median :4.800
Mean :20.66 Mean :4.919
3rd Qu.:22.00 3rd Qu.:5.800
Max. :24.00 Max. :8.500
Platform Affects_Academic_Performance Sleep_Hours Mental_Health_Score
Length:705 Length:705 Min. :3.800 Min. :4.000
Class :character Class :character 1st Qu.:6.000 1st Qu.:5.000
Mode :character Mode :character Median :6.900 Median :6.000
Mean :6.869 Mean :6.227
3rd Qu.:7.700 3rd Qu.:7.000
Max. :9.600 Max. :9.000
Relationship_Status Conflicts Addicted_Score
Length:705 Min. :0.00 Min. :2.000
Class :character 1st Qu.:2.00 1st Qu.:5.000
Mode :character Median :3.00 Median :7.000
Mean :2.85 Mean :6.437
3rd Qu.:4.00 3rd Qu.:8.000
Max. :5.00 Max. :9.000
ggplot(Social_Media_Addiction)+
aes(Age)+
geom_histogram()
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
The bar chart indicates that this survey was done on students.
ggplot(Social_Media_Addiction)+
aes(Platform)+
geom_bar()+
theme(axis.text.x = element_text(angle = 45, hjust = 1))
The bar graph shows that Instagram is the most popular app used by students, followed by TikTok.
ggplot(Social_Media_Addiction)+
aes(Platform, fill = Gender)+
geom_bar()+
theme(axis.text.x = element_text(angle = 45, hjust = 1))
From this graph, I know that more female use Instagram and more male use Facebook.
ggplot(Social_Media_Addiction)+
aes(Sleep_Hours, Mental_Health_Score)+
geom_jitter()
By looking at this jitter plot, I know that the more sleep you get, the better your mental health will be.
ggplot(Social_Media_Addiction, aes(x = Daily_Hours, y = Sleep_Hours)) +
geom_point() +
facet_wrap(~ Gender)
This graph shows that gender does not play a role in the relationship between sleep duration and social media usage time.
ggplot(Social_Media_Addiction, aes(x = Daily_Hours, y = Sleep_Hours)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "Linear Regression of Sleep Hours on Daily Usage Hours ", x = "Daily usage hours", y = "Sleep hours")
`geom_smooth()` using formula = 'y ~ x'
This graph shows the relationship between daily usage hours and sleep hours. It’s representing that as the amount of time spent using social media increases, the amount of time spent sleeping is decreasing.
ggplot(Social_Media_Addiction, aes(x = Addicted_Score, fill = Affects_Academic_Performance)) +
geom_bar(position = "fill") +
labs(title = "Rate of Affection on Academic Performance by Addicted Score", y = "Proportion") +
scale_fill_manual(values = c("blue", "turquoise")) +
theme_minimal()
This graph demonstrates that the higher the addiction score, the more likely it is to affect the academic performance.
ggplot(Social_Media_Addiction, aes(x = Mental_Health_Score, fill = Affects_Academic_Performance)) +
geom_bar(position = "fill") +
labs(title = "Rate of Affection on Academic Performance by Mental Health Score", y = "Proportion") +
scale_fill_manual(values = c("blue", "turquoise")) +
theme_minimal()
This graph demonstrates that the higher the Mental health score, the less likely it is to affect the academic performance.
ggplot(Social_Media_Addiction, aes(x = Affects_Academic_Performance, y = Age, fill = Affects_Academic_Performance)) +
geom_violin(alpha = 0.5) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9)) +
labs(title = "Age Distribution by Affection on Academic Performance", y = "Age", x = "Affection on Academic Performance") +
scale_fill_manual(values = c("blue", "turquoise")) +
facet_wrap(~Gender) +
theme(legend.position = "none") +
theme_minimal()
This graph is showing that males are older than females who answered this survey.