From dd66f2f9237a995db994bf4bf243490ada63e65d Mon Sep 17 00:00:00 2001 From: rehughes07 <58590776+rehughes07@users.noreply.github.com> Date: Mon, 25 Oct 2021 16:13:22 +0100 Subject: [PATCH] Pie Charts and More Data Finagling Figuring how to put frequencies of multiple response data into a clean format, then creating rough code for a simple pie chart (to be made pretty later). Finished this for the 3 questions needing pie charts. --- Connect Project R Markdown.Rmd | 65 +++++++++++++++++++++++-- data/.Rhistory | 74 +++++------------------------ data/Q26_data.csv | 86 ++++++++++++++++++++++++++++++++++ data/Q3 copydata.csv | 86 ++++++++++++++++++++++++++++++++++ 4 files changed, 246 insertions(+), 65 deletions(-) create mode 100644 data/Q26_data.csv create mode 100644 data/Q3 copydata.csv diff --git a/Connect Project R Markdown.Rmd b/Connect Project R Markdown.Rmd index fe41289..bc30e75 100644 --- a/Connect Project R Markdown.Rmd +++ b/Connect Project R Markdown.Rmd @@ -31,7 +31,7 @@ Note that the `echo = FALSE` parameter was added to the code chunk to prevent pr ## Upload Data ```{r Data Upload} -connect_data = read.csv("connectDATA.csv") +connect_data = read.csv("~/Documents/Github/re_connect_survey/data/connectDATA.csv") ``` ## Summary of Data @@ -60,6 +60,25 @@ pie(Q25_frequencies, labels = c("Maybe", "No", "Yes")) # rough draft of piechart ```{r Q26 bar/pie} + +Q26_data <- read.csv("~/Documents/Github/re_connect_survey/data/Q26_data.csv") + +Q26_freq_data <- data.frame(c("Other Priorities", "Lack Subject Knowledge", "Lack Confidence", "Current Syllabus", "Pupil Disinterest", "Department Head", "Available Work Schemes", "Unavailable Resources", "Uncertain of Pedagogical Approach"), c(table(Q26_data[,2]) [names(table(Q26_data[,2])) == "TRUE"], + table(Q26_data[,3]) [names(table(Q26_data[,3])) == "TRUE"], + table(Q26_data[,4]) [names(table(Q26_data[,4])) == "TRUE"], + table(Q26_data[,5]) [names(table(Q26_data[,5])) == "TRUE"], + table(Q26_data[,6]) [names(table(Q26_data[,6])) == "TRUE"], + table(Q26_data[,7]) [names(table(Q26_data[,7])) == "TRUE"], + table(Q26_data[,8]) [names(table(Q26_data[,8])) == "TRUE"], + table(Q26_data[,9]) [names(table(Q26_data[,9])) == "TRUE"], + table(Q26_data[,10]) [names(table(Q26_data[,10])) == "TRUE"])) + +head(Q26_freq_data) +names(Q26_freq_data)[1] <- "Reasons" +names(Q26_freq_data)[2] <- "Frequency" +head(Q26_freq_data) +pie(Q26_freq_data$Frequency, labels = c("Other Priorities", "Lack Subject Knowledge", "Lack Confidence", "Current Syllabus", "Pupil Disinterest", "Department Head", "Available Work Schemes", "Unavailable Resources", "Uncertain of Pedagogical Approach")) + ``` pie(Q26_freq) @@ -67,7 +86,39 @@ pie(Q26_freq) ```{r Q3 bar/pie} -Q3_data <- read.csv("Q3.csv") +Q3_data <- read.csv("~/Documents/Github/re_connect_survey/data/Q3.csv") + +#head(Q3_data) +#table(Q3_data [,3:7]) +#pie(table(Q3_data [,3:7])) + +Q3_data2 <- Q3_data[,3:7] +#head(Q3_data2) +#table(Q3_data2) +#table(Q3_data2[,1]) + +### want to take only the count of "True" (1) in each column. Then pie chart of the frequencies + +#Q3_data3 <- read.csv("~/Documents/Github/re_connect_survey/data/Q3 copydata.csv") + +#table(Q3_data3) + #count(Q3_data3, 1) +#table(Q3_data3) [names(table(Q3_data3)) == 1] +#table(Q3_data3) + +table(Q3_data2[,1]) [names(table(Q3_data2[,1])) == "TRUE"] + +test2 <- data.frame(c("Worldviews", "Religion", "Theology", "Ethics", "Philosophy"), c(table(Q3_data2[,1]) [names(table(Q3_data2[,1])) == "TRUE"], + table(Q3_data2[,2]) [names(table(Q3_data2[,2])) == "TRUE"], + table(Q3_data2[,3]) [names(table(Q3_data2[,3])) == "TRUE"], + table(Q3_data2[,4]) [names(table(Q3_data2[,4])) == "TRUE"], + table(Q3_data2[,5]) [names(table(Q3_data2[,5])) == "TRUE"])) +head(test2) +names(test2)[1] <- "Subject" +names(test2)[2] <- "Frequency" +head(test2) +pie(test2$Frequency, labels = c("Worldviews", "Religion", "Theology", "Ethics", "Philosophy")) + ``` @@ -75,7 +126,15 @@ Q3_data <- read.csv("Q3.csv") pie(Q3_freq) #also not optimal as pie...perhaps bar + #sum(Q3_data2) + +Q3_1factor = as.factor(Q3_data2$Religion) +table(Q3_1factor) + #count(Q3_1factor, "TRUE") + #test = replace(Q3_1factor, "TRUE", 1) + #test + #Q3_1factor - RH: display summaries of responses to key questions for Q22 (syllabus evaluation), Q23, Q24, Q25, Q26, Q27, with subsetting by: - Q8 (school type) @@ -113,4 +172,4 @@ pie(Q3_freq) ```{r Correlation 1} ``` - - RH: test for correlation between responses to religion questions: Q12-14, Q15-16 and Q21 and responses to Q22, Q23, Q24, Q25, Q27, Q30 + - RH: test for correlation between responses to religion questions: Q12-14, Q15-16 and Q21 and responses to Q22, Q23, Q27, [Q24, Q25, Q30] diff --git a/data/.Rhistory b/data/.Rhistory index efd3b4e..0edef57 100644 --- a/data/.Rhistory +++ b/data/.Rhistory @@ -1,64 +1,14 @@ -connect_data = read.csv("connectDATA.csv") -connect_data = read.csv("connectDATA.csv") -head(connect_data) -View(connect_data) -table(connect_data$Q25) -Q25_frequencies = table(connect_data$Q25) -Q25_frequencies = table(connect_data$Q25) -Q26_freq = table(connect_data$Q26) -Q25_frequencies = table(connect_data$Q25) -Q26_freq = table(connect_data$Q26) -Q26_freq -connect_data = read.csv("connectDATA.csv") -head(connect_data) -connect_data = read.csv("connectDATA.csv") -connect_data = read.csv("connectDATA.csv") -view(connect_data) -View(connect_data) -Q25_frequencies = table(connect_data$Q25) -Q26_freq = table(connect_data$Q26) -Q26_freq -Q25_frequencies = table(connect_data$Q25) -Q_25_frequencies -Q26_freq = table(connect_data$Q26) -Q26_freq -Q25_frequencies = table(connect_data$Q25) -Q_25frequencies -Q26_freq = table(connect_data$Q26) -Q26_freq -Q_25frequencies -Q25_frequencies = table(connect_data$Q25) -Q25_25frequencies -Q25_frequencies -test3 = as.factor(connect_data$Q3, levels = c(1, 2, 3, 4, 5), labels = c("Worldviews", "Religion", "Theology", "Ethics", "Philosophy")) -pie(connect_data$Q25, labels = names(connect_data$Q25)) -pie(Q25_frequencies, labels = names(connect_data$Q25)) -pie(Q25_frequencies, labels = names(c("maybe", "yes", "no"))) -pie(Q25_frequencies, labels = names(connect_data$Q25)) -names(Q25_frequencies = c("Maybe", "No", "Yes")) -pie(Q25_frequencies, labels = c("Maybe", "No", "Yes")) -pie(Q26_freq) -Q25_frequencies = table(connect_data$Q25) -Q25_frequencies -Q26_freq = table(connect_data$Q26) -Q26_freq -Q3_freq = table(connect_data$Q3) -Q25_frequencies = table(connect_data$Q25) -Q25_frequencies -Q26_freq = table(connect_data$Q26) -Q26_freq -Q3_freq = table(connect_data$Q3) -Q3_freq -pie(Q3_freq) knitr::opts_chunk$set(echo = TRUE) -pie(Q25_frequencies, labels = c("Maybe", "No", "Yes")) -cor(Q_20, Q_22, data=connect_data) -cor(connect_data$Q_20, connect_dataQ_22) -cor(connect_data$Q_20, connect_data$Q_22) -Q3_data <- read.csv("Q3.csv") +connect_data = read.csv("connectDATA.csv") +read.csv("connectDATA.csv") +## Summary of Data +Data summary/visualisation with subsetting: +- RH: display simple summary of data (bar/pie chart) to Q25/26, Q3 +read.csv("connectDATA.csv") setwd("~/Documents/GitHub/re_connect_survey/data") -Q3_data <- read.csv("Q3.csv") -read.csv("Q3.csv) -data=read.csv("Q3.csv) -Q3_data <- read.csv("Q3.csv") -Q3_data <- read.csv("Q3.csv") +setwd("~/Documents/GitHub/re_connect_survey/data") +connect_data = read.csv("connectDATA.csv") +setwd("~/Documents/GitHub/re_connect_survey/data") +connect_data = read.csv("connectDATA.csv") +Q3data = read.csv("Q3.csv") +connect_data = read.csv("~/gits/re_connect_survey/data/connectDATA.csv") diff --git a/data/Q26_data.csv b/data/Q26_data.csv new file mode 100644 index 0000000..073869f --- /dev/null +++ b/data/Q26_data.csv @@ -0,0 +1,86 @@ +Q26,Other Priorities,Lack Subject Knowledge,Lack Confidence,Current Syllabus,Pupil Disinterest,Department Head,Available Work Schemes,Unavailable Resources,Uncertain of Pedagogical Approach +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +"7,8,9",FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE +3,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +"1,4",TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +1,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +"1,3,8,9",TRUE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE +"1,5,9",TRUE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,TRUE +"7,8",FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,FALSE +"1,4",TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +1,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +7,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE +"7,8",FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,FALSE +"4,7,9",FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE +"7,9",FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,TRUE +8,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE +1,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +"1,7",TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +"3,4",FALSE,FALSE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +"7,8",FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +"1,4",TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +"2,4,7,8",FALSE,TRUE,FALSE,TRUE,FALSE,FALSE,TRUE,TRUE,FALSE +"4,6,7,8",FALSE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE,TRUE,FALSE +"4,7,8",FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,TRUE,FALSE +"1,7,8,9",TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE +1,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +"2,3",FALSE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +"1,2",TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +"4,6,7",FALSE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE,FALSE,FALSE +"2,7,8",FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +7,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +"7,9",FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,TRUE +"7,8,9",FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE +1,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +"4,9",FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE +"4,7,9",FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE +"2,4,6",FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,FALSE,FALSE +"1,7,8",TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +7,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE +"4,8",FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,TRUE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +"7,8",FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,FALSE +"4,8",FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,TRUE,FALSE +"4,7,8",FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,TRUE,FALSE +6,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE +3,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +1,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +"1,2,3,8",TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE +"4,8",FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,TRUE,FALSE +"2,3,4,8",FALSE,TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,TRUE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +"1,7",TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE +"1,4",TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +"3,8,9",FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE +"2,3,4,7",FALSE,TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +"4,7,8",FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,TRUE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +"2,4,7",FALSE,TRUE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE +"4,7,8",FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,TRUE,FALSE +3,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE +9,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE +"3,4,7,8",FALSE,FALSE,TRUE,TRUE,FALSE,FALSE,TRUE,TRUE,FALSE +4,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE +"2,3,4,7,8,9",FALSE,TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,TRUE,TRUE +"4,7",FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE \ No newline at end of file diff --git a/data/Q3 copydata.csv b/data/Q3 copydata.csv new file mode 100644 index 0000000..2f660d2 --- /dev/null +++ b/data/Q3 copydata.csv @@ -0,0 +1,86 @@ +Worldviews,Religion,Theology,Ethics,Philosophy +2,1,1,1,1 +1,1,1,1,1 +1,1,1,1,1 +2,1,2,2,1 +1,1,1,1,1 +1,1,1,2,1 +1,1,1,1,1 +2,1,1,1,1 +1,1,1,1,1 +1,1,1,1,1 +1,1,1,2,1 +1,1,1,1,1 +1,1,1,1,1 +2,1,2,1,1 +1,1,1,1,1 +2,1,2,2,2 +1,1,1,1,1 +1,1,2,1,1 +2,1,2,2,2 +1,1,1,1,1 +1,1,1,1,1 +1,1,1,1,1 +2,1,1,1,1 +1,1,1,1,1 +1,1,1,1,1 +2,1,2,2,2 +1,1,2,2,2 +1,1,2,2,2 +1,1,2,2,2 +1,1,1,1,1 +2,1,2,2,2 +1,1,1,1,1 +1,1,1,1,2 +1,1,1,1,1 +1,1,1,1,1 +1,1,2,2,2 +1,1,1,1,1 +1,1,1,1,1 +2,1,1,2,1 +1,1,1,1,1 +2,1,2,2,2 +2,1,2,2,2 +2,1,2,2,2 +1,1,2,2,2 +1,1,1,1,1 +1,1,1,1,1 +1,1,1,1,1 +2,1,2,2,2 +2,1,2,2,2 +2,1,2,2,2 +1,1,2,2,2 +2,1,2,2,2 +2,1,2,1,1 +1,1,2,1,1 +2,1,1,1,1 +1,1,1,2,2 +2,1,2,2,2 +1,1,1,2,1 +1,1,1,1,1 +2,1,2,2,2 +2,1,1,1,1 +1,1,2,2,2 +1,1,1,1,1 +1,1,1,1,1 +2,1,1,1,1 +1,1,2,2,2 +1,1,2,2,2 +2,2,2,1,2 +1,1,1,1,1 +2,1,2,2,2 +1,1,2,1,1 +1,1,2,2,2 +1,1,2,2,2 +1,1,2,2,2 +2,1,2,2,2 +2,1,1,1,1 +1,1,2,2,2 +2,1,2,2,2 +2,1,2,2,2 +2,1,2,2,2 +1,1,2,1,2 +1,2,2,2,1 +1,1,2,2,2 +1,1,2,1,1 +2,1,2,2,2 \ No newline at end of file