Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- title: "Edgewood project"
- author: "Duy Phan"
- date: "June 19, 2018"
- output: html_document
- ---
- Install openxlsx package
- ```{r}
- #install.packages("openxlsx")
- #install.packages("prettyR")
- #install.packages("psych")
- #install.packages("reshape")
- #install.packages("reshape2")
- #install.packages("tidyverse")
- library("tidyverse")
- library("reshape2")
- library("reshape")
- library("prettyR")
- library("openxlsx")
- library("psych")
- ```
- Setting the working directory. (!) Pay attention to the direction of the slash in the directory.
- read the xlsx file
- ```{r}
- setwd("D:/Box Sync/5. Summer 2018/CRI Summer 2018/R/Edgewood project")
- dat <- read.xlsx("SIS_Edgewood_Date_Numerical.xlsx", colNames = TRUE, na.strings = c("na","blank","na "))
- ```
- Make a copy of the file in csv
- ```{r}
- write.csv(dat, "dat1.csv", row.names = FALSE)
- dat1 <- read.csv("dat1.csv")
- head(dat1)
- ```
- View how many observations we have
- ```{r}
- dim(dat1)
- ```
- Remove collumn Race
- ```{r}
- dat2 = subset(dat1, select= -c(Race))
- names(dat2)[9]<-"Q1_pre"
- ```
- Remove na data (blank cells)
- ```{r}
- dat2 = na.omit(dat2)
- dim(dat2)
- head(dat2)
- ```
- The average for column E "The information [of SIS] provided" (it's on a scale of 1 - 10)
- ```{r}
- round(mean(dat2$Info.Provided), digit =2)
- ```
- The average of column F "The presenters" (scale of 1 -10)
- ```{r}
- round(mean(dat2$Presenters),digit = 2)
- ```
- 'In column H ["Do you feel more confident about your communication skills following the training?"] the breakdown of students who answered '1' (e.g. yes), '2' (e.g. no) , and '3' (e.g. kinda)
- ```{r}
- describe.factor(dat2$Feel.more.confident.)
- ```
- The difference between pre-test (e.g. columns J - T) answers and post-test (e.g. columns U - AE) answers to determine if there were statistically significant changes.
- ```{r}
- m1p = mean(dat2$Q1_pre)
- m2p = mean(dat2$Q2_pre)
- m3p = mean(dat2$Q3_pre)
- m4p = mean(dat2$Q4_pre)
- m5p = mean(dat2$Q5_pre)
- m6p = mean(dat2$Q6_pre)
- m7p = mean(dat2$Q7_pre)
- m8p = mean(dat2$Q8_pre)
- m9p = mean(dat2$Q9_pre)
- m10p = mean(dat2$Q10_pre)
- m11p = mean(dat2$Q11_pre)
- m1po = mean(dat2$Q1_post)
- m2po = mean(dat2$Q2_post)
- m3po = mean(dat2$Q3_post)
- m4po = mean(dat2$Q4_post)
- m5po = mean(dat2$Q5_post)
- m6po = mean(dat2$Q6_post)
- m7po = mean(dat2$Q7_post)
- m8po = mean(dat2$Q8_post)
- m9po = mean(dat2$Q9_post)
- m10po = mean(dat2$Q10_post)
- m11po = mean(dat2$Q11_post)
- Pre = c(m1p,m2p,m3p,m4p,m5p,m6p,m7p,m8p,m9p,m10p,m11p)
- Post= c(m1po,m2po,m3po,m4po,m5po,m6po,m7po,m8po,m9po,m10po,m11po)
- Change = Post - Pre
- dat3 = data.frame(Pre,Post,Change)
- dat3
- round(mean(Pre), digit = 2)
- round(mean(Post), digit = 2)
- round(mean(Change), digit = 2)
- ```
- ```{r}
- #Matt way
- dat2new = dat2[,9:30]
- dat2new = data.frame(meansData = apply(dat2new,2,mean))
- dat2new
- dat2Post = dat2new[12:22,]
- dat2Pre = dat2new[1:11,]
- dat2Diff =dat2Post-dat2Pre
- dat2Diff
- dat3new = data.frame(dat2Pre, dat2Post,dat2Diff)
- head(dat3new)
- ```
- Compare average between classes
- ```{r}
- Group.classes = ifelse(dat2$Class..<=2,1,ifelse(dat2$Class..>=4,3,2))
- dat2$Group.classes = Group.classes
- dat2$Group.classes = as.factor(dat2$Group.classes)
- dat4 = aggregate(dat2[,9:30], list(dat2$Group.classes), mean)
- dat4$ch1 = dat4$Q1_post-dat4$Q1_pre
- dat4$ch2 = dat4$Q2_post-dat4$Q2_pre
- dat4$ch3 = dat4$Q3_post-dat4$Q3_pre
- dat4$ch4 = dat4$Q4_post-dat4$Q4_pre
- dat4$ch5 = dat4$Q5_post-dat4$Q5_pre
- dat4$ch6 = dat4$Q6_post-dat4$Q6_pre
- dat4$ch7 = dat4$Q7_post-dat4$Q7_pre
- dat4$ch8 = dat4$Q8_post-dat4$Q8_pre
- dat4$ch9 = dat4$Q9_post-dat4$Q9_pre
- dat4$ch10 = dat4$Q10_post-dat4$Q10_pre
- dat4$ch11 = dat4$Q11_post-dat4$Q11_pre
- head(dat4)
- ```
- T-test for each questions
- ```{r}
- t.test(dat2$Q1_post, dat2$Q1_pre, paired = TRUE)
- t.test(dat2$Q2_post, dat2$Q2_pre, paired = TRUE)
- t.test(dat2$Q3_post, dat2$Q3_pre, paired = TRUE)
- t.test(dat2$Q4_post, dat2$Q4_pre, paired = TRUE)
- t.test(dat2$Q5_post, dat2$Q5_pre, paired = TRUE)
- t.test(dat2$Q6_post, dat2$Q6_pre, paired = TRUE)
- t.test(dat2$Q7_post, dat2$Q7_pre, paired = TRUE)
- t.test(dat2$Q8_post, dat2$Q8_pre, paired = TRUE)
- t.test(dat2$Q9_post, dat2$Q9_pre, paired = TRUE)
- t.test(dat2$Q10_post, dat2$Q10_pre, paired = TRUE)
- t.test(dat2$Q11_post, dat2$Q11_pre, paired = TRUE)
- ```
- Wilcoxon tests for each questions
- ```{r}
- wilcox.test(dat2$Q1_post, dat2$Q1_pre, paired = TRUE)
- wilcox.test(dat2$Q2_post, dat2$Q2_pre, paired = TRUE)
- wilcox.test(dat2$Q3_post, dat2$Q3_pre, paired = TRUE)
- wilcox.test(dat2$Q4_post, dat2$Q4_pre, paired = TRUE)
- wilcox.test(dat2$Q5_post, dat2$Q5_pre, paired = TRUE)
- wilcox.test(dat2$Q6_post, dat2$Q6_pre, paired = TRUE)
- wilcox.test(dat2$Q7_post, dat2$Q7_pre, paired = TRUE)
- wilcox.test(dat2$Q8_post, dat2$Q8_pre, paired = TRUE)
- wilcox.test(dat2$Q9_post, dat2$Q9_pre, paired = TRUE)
- wilcox.test(dat2$Q10_post, dat2$Q10_pre, paired = TRUE)
- wilcox.test(dat2$Q11_post, dat2$Q11_pre, paired = TRUE)
- ```
- Comparing overall average responses
- ```{r}
- ```
- Sex and age distribution in classes
- ```{r}
- dat5 = data.frame(dat2$Sex,dat2$Group.classes)
- dat5 = dcast(dat5,dat2.Group.classes~dat2.Sex)
- head(dat5)
- ```
Add Comment
Please, Sign In to add comment