0% found this document useful (0 votes)
9 views8 pages

Survey Analysis: Social Media Impact

The document contains R code for analyzing survey data from a CSV file, focusing on descriptive statistics and visualizations for various questions related to college students' social media usage and its effects. It includes bar plots, histograms, and pie charts to present findings on GPA, social media usage, and perceptions of relationships. Additionally, it performs a t-test on the data related to the quality of relationships improved by social media.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views8 pages

Survey Analysis: Social Media Impact

The document contains R code for analyzing survey data from a CSV file, focusing on descriptive statistics and visualizations for various questions related to college students' social media usage and its effects. It includes bar plots, histograms, and pie charts to present findings on GPA, social media usage, and perceptions of relationships. Additionally, it performs a t-test on the data related to the quality of relationships improved by social media.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

R code

Part 3. Descriptive Results and Findings

setwd("C:/001K12")

data <- [Link]("[Link]", stringsAsFactors = FALSE)

colnames(data)

data <- data[-46, ]

#Q1

year <- data$Q1

year_freq <- table(year)

year_freq

percentages <- round(100 * year_freq / sum(year_freq), 1)

labels <- paste(names(year_freq), "-", percentages, "%")

barplot(year_freq,

legend = labels,

main = "College year of Survey Participant",

#Q2
data$Q2 <- [Link](data$Q2)

hist(data$Q2,

main = "GPAs of survey participant",

xlab = "GPA",

col = "lightblue",

border = "white")

summary(data$Q2)

mean(data$Q2, [Link] = TRUE)

median(data$Q2, [Link] = TRUE)

sd(data$Q2, [Link] = TRUE)

#Q3

data$Q3 <- [Link](data$Q3)

hist(data$Q3,

main = "Histogram of Hours Use Per Day",

xlab = "Hours per Day",

col = "lightblue",
border = "white")

summary(data$Q3)

mean(data$Q3, [Link] = TRUE)

median(data$Q3, [Link] = TRUE)

sd(data$Q3, [Link] = TRUE)

#Q4

social_media <- data$Q4

social_media_freq <- table(social_media)

social_media_freq

percentages <- round(100 * social_media_freq / sum(social_media_freq), 1)

labels <- paste(names(social_media_freq), "-", percentages, "%")

pie(social_media_freq,

labels = labels,

col = c("skyblue", "lightgreen", "lightpink","orange","red"),

main = "Pie chart of social network usage")

#Q5

purpose <- data$Q5

purpose_freq <- table(purpose)


purpose_freq

percentages <- round(100 * purpose_freq / sum(purpose_freq), 1)

labels <- paste(names(purpose_freq), "-", percentages, "%")

pie(purpose_freq,

labels = labels,

col = c("skyblue", "lightgreen", "lightpink","orange","red"),

main = "Pie chart of primary purposes when using social network")

#Q6

maintain_relationship <- data$Q6

maintain_relationship_freq <- table(maintain_relationship)

maintain_relationship_freq

barplot(maintain_relationship_freq,

legend= names(maintain_relationship_freq),

col = c("skyblue", "lightgreen", "lightpink","orange","red"),

main = "How social media helps to maintain relationship",

ylab = "Frequency"

)
#Q7

expand_relationship <- data$Q7

expand_relationship_freq <- table(expand_relationship)

expand_relationship_freq

percentages <- round(100 * expand_relationship_freq / sum(expand_relationship_freq),


1)

labels <- paste(names(expand_relationship_freq), "-", percentages, "%")

pie(expand_relationship_freq,

labels = labels,

col = c("skyblue", "lightgreen", "lightpink","orange","red"),

main = "how using social network expands number of friendships")

legend("topright",

legend = c("Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"),

fill = c("skyblue", "lightgreen", "lightpink","orange","red"))

summary(data$Q7)

mean(data$Q7, [Link] = TRUE)


median(data$Q7, [Link] = TRUE)

sd(data$Q7, [Link] = TRUE)

#Q8

feeling <- data$Q8

feeling_freq <- table(feeling)

feeling_freq

percentages <- round(100 * feeling_freq / sum(expand_relationship_freq), 1)

labels <- paste(names(feeling_freq), "-", percentages, "%")

barplot(feeling_freq,

col = c("skyblue", "lightgreen"),

legend = labels,

main = "Feeling left out after seeing friends hanging out without you",

#Q9

conflict <- data$Q9

conflict_freq <- table(conflict)


conflict_freq

percentages <- round(100 * conflict_freq / sum(conflict_freq), 1)

labels <- paste(names(conflict_freq), "-", percentages, "%")

pie2 <- pie(expand_relationship_freq,

labels = labels,

col = c("skyblue", "lightgreen", "lightpink","orange","red"),

main = "how using social network causes conflicts in friendships")

#Q10

quality <- data$Q10

quality_freq <- table(quality)

quality_freq

percentages <- round(100 * quality_freq / sum(quality_freq), 1)

labels <- paste(names(quality_freq), "-", percentages, "%")

pie1 <- pie(quality_freq,


labels = labels,

col = c("skyblue", "lightgreen", "lightpink","orange","red"),

main = "Relationship Quality is Improved by Social Media")

legend("topright",

legend = c("Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"),

fill = c("skyblue", "lightgreen", "lightpink","orange","red"))

summary(data$Q10)

mean(data$Q10, [Link] = TRUE)

median(data$Q10, [Link] = TRUE)

sd(data$Q10, [Link] = TRUE)

Part 4. Results and Findings of the Hypothesis Test

data <- [Link]("[Link]")

t_test_result <- [Link](data$Q10, mu = 3)

print(t_test_result)

You might also like