trs_admissions_survey2021/.Rhistory

41 lines
4.3 KiB
R
Raw Normal View History

2021-12-12 22:41:32 +00:00
knitr::opts_chunk$set(echo = TRUE)
TSR_data <- read.csv("./data/TSR data complete.csv")
```{r respondent age}
TSR_data$Age <- factor(TSR_data$Age, levels = c(1, 2, 3, 4, 5, 6, 7, 8), labels = c("15 or under", "16", "17", "18", "19", "20", "21 or over", "Prefer not to say"))
```{r respondent_age}
age_pie <- pie(table(TSR_data$Age))
TSR_data$MOST.RECENT.year.of.study <- factor(TSR_data$MOST.RECENT.year.of.study, levels = c(1, 2, 3, 4, 5, 6, 7, 8, 9), labels = c("Year 11/S4/Year 12(NI)", "Year 12/S5/Year 13(NI)", "Year 13/S6/Year 14(NI)", "I am currently on a gap year", "I am currently on an undergraduate/HE college course", "I am in full-time employment", "I am unemployed", "Other", "Prefer not to say"))
Year_study_pie <- pie(table(TSR_data$MOST.RECENT.year.of.study))
TSR_data$Gender <- factor(TSR_data$Gender, levels = c(1, 2, 3, 4), labels = c("Male", "Female", "I identify my gender in another way", "Prefer not to say"))
gender_pie <- pie(table(TSR_data$Gender))
library(ggplot2)
TSR_data$Ethnicity <- factor(TSR_data$Ethnicity, levels = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 ,18, 19), labels = c("Arab", "Asian/Asian British - Indian", "Asian/Asian British - Pakistani", "Asian/Asian British - Bangladeshi", "Asian/Asian British - Chinese", "Asian/Asian British - Any other Asian background", "Black/Black British - African", "Black/Black British - Caribbean", "Black/Black British - Any other Black background", "Mixed/Multiple Ethnic Groups - White and Black Caribbean", "Mixed/Multiple Ethnic Groups - White and Black African", "Mixed/Multiple Ethnic Groups - White and Black Asian", "Mixed/Multiple Ethnic Groups - Any other Mixed/Multiple Ethnic background", "White - English/Welsh/Scottish/Northern Irish/British", "White - Irish", "White - Gypsy or Irish Traveller", "White - Any other White background", "Other Ethnic group, please describe", "Prefer not to say"))
Ethnicity_bar <- ggplot(TSR_data, aes(Ethnicity)) + geom_bar() + coord_flip()
Ethnicity_bar
TSR_data$Religious.Affliation <- factor(TSR_data$Religious.Affliation, levels = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19), labels = c("Agnostic", "Atheist", "Baha'i", "Buddhist", "Christian", "Confucian", "Jain", "Jewish", "Hindu", "Indigenous Traditional Religious", "Muslim", "Pagan", "Shinto", "Sikh", "Spiritual but not religious", "Zoroastrian", "No religion", "Prefer not to say", "Other"))
Religious_affiliation_bar <- ggplot(TSR_data, aes(Religious.Affliation)) + geom_bar() + coord_flip()
Religious_affiliation_bar
subject_data <- read.csv("./data/Subject data.csv")
#Q5 Subject Knowledge/Understanding
subject_data$Subject <- factor(subject_data$Subject, levels = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), labels = c("Philosophy", "Sociology", "Psychology", "History", "Ethics", "Theology", "Religious Studies", "Politics", "English", "Math", "Computer Science", "Business"))
understanding_mean <- aggregate(Understanding ~ Subject, data = subject_data, mean)
understanding_bar <- ggplot(understanding_mean, aes(x = Subject, y = Understanding)) + stat_summary(fun = "mean", geom = "bar") + coord_flip()
understanding_bar
#Q6 Subject Interest
interest_mean <- aggregate(Interest ~ Subject, data = subject_data, mean)
interest_bar <- ggplot(interest_mean, aes(x = Subject, y = Interest)) + stat_summary(fun = "mean", geom = "bar") + coord_flip()
interest_bar
employability_mean <- aggregate(Employability ~ Subject, data = subject_data, mean)
employability_bar <- ggplot(employability_mean, aes(x = Subject, y = Employability)) + stat_summary(fun = "mean", geom = "bar") + coord_flip()
employability_bar
keysubjects_data <- subject_data[subject_data$Subject == "Philosophy" | subject_data$Subject == "Ethics" | subject_data$Subject == "Theology" | subject_data$Subject == "Religious Studies", ]
recode_interest <- ifelse(1 <= keysubjects_data$Interest & keysubjects_data$Interest >=3, "Positive", "Negative")
keysubjects_data <- cbind(keysubjects_data, recode_interest)
keysubjects_data$recode_interest <- factor(keysubjects_data$recode_interest)
table(keysubjects_data$recode_interest, keysubjects_data$Subject)
understanding_bar
#Q6 Subject Interest
interest_mean <- aggregate(Interest ~ Subject, data = subject_data, mean)
interest_bar <- ggplot(interest_mean, aes(x = Subject, y = Interest)) + stat_summary(fun = "mean", geom = "bar") + coord_flip()
interest_bar