knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
## -- Attaching packages ------------------------------------------------------------------------------------------- tidyverse 1.2.1 --
## v ggplot2 2.2.1     v purrr   0.2.4
## v tibble  1.4.1     v dplyr   0.7.4
## v tidyr   0.7.2     v stringr 1.2.0
## v readr   1.1.1     v forcats 0.2.0
## -- Conflicts ---------------------------------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(dplyr); library(ggplot2); library(tibble); library(readr);
source("http://pcwww.liv.ac.uk/~william/R/crosstab.r")

1) Display how respondents responded to four key attitude items (#18-21), using a barchart or something similar. Anything interesting from this univariate analysis?

FacWriting <- read.csv("C:/LocalFiles/Documents/Freshman TSU/STAT-220/HW 3/FacWriting.csv")
View(FacWriting)
FacWritingAttitude <- select(FacWriting, c(32,33,34,35,37,38,40,41))     
View(FacWritingAttitude)

Below is a barchart concerning the variable WACTimprove and the count of individuals who chose each option on the survey.

ggplot(data=FacWritingAttitude, aes(x=`WACTimprove`)) +   
  geom_bar(fill="blue")

Below is a barchart concerning the variable JINSImprove and the count of individuals who chose each option on the survey.

ggplot(data=FacWritingAttitude, aes(x=`JINSImprove`)) +   
  geom_bar(fill="orange")

Below is a barchart concerning the variable GradStrong and the count of individuals who chose each option on the survey.

ggplot(data=FacWritingAttitude, aes(x=`GradStrong`)) +   
  geom_bar(fill="red")

Below is a barchart concerning the variable SufficientlyPrepared and the count of individuals who chose each option on the survey.

ggplot(data=FacWritingAttitude, aes(x=`SufficientlyPrepared`)) +   
  geom_bar(fill="purple")

From the first barchart, I can see that the most people responded 6 (moderately agree) to whether or not Writing as Critical Thinking improved student writing skills. From the second barchart, most people responded 6 as well concerning JINS classes. There were more response 6 answers in the first barchart, but more higher responses in general in the second. On the third barchart, peope had the highest responses of the four variables. Respondents stated that graduates are strong writers when they leave Truman. Few people disagreed. Finally, the fourth barchart shows the most people stating that they moderately agree that Truman graduates are prepared for field-specific writing. Again, there are few respondants that strongly disagree.

2) Now, break those four key items down by four key demographic items (#23-27, skip 25). For each of the four demographic items, make both a crosstab table and a boxplot of the 16 interactions (four attitudes by four demographics). Yes, that’s 16 separate tables and 16 plots (you might try to use gather from tidyr to avoid doing all 36 separately). Do you notice anything interesting?

Boxplot: Time at Truman

FacWritingAttitude <- select(FacWriting, c(32,33,34,35,37,38,40,41))%>%
  mutate(WACTimprove = as.numeric(WACTimprove),
         JINSImprove = as.numeric(JINSImprove),
         GradStrong = as.numeric(GradStrong),
         SufficientlyPrepared = as.numeric(SufficientlyPrepared))
FacWritingAttitude %>%
  gather(-TimeAtTruman, key = "var", value = "value", na.rm=TRUE) %>%
  ggplot() +
  geom_boxplot(aes(y = TimeAtTruman, x = value)) +
  facet_wrap(~ var, scales = "free")
## Warning: attributes are not identical across measure variables;
## they will be dropped
## Warning: Removed 18 rows containing non-finite values (stat_boxplot).

Boxplot: Gender

FacWritingAttitude <- select(FacWriting, c(32,33,34,35,37,38,40,41))%>%
  mutate(WACTimprove = as.numeric(WACTimprove),
         JINSImprove = as.numeric(JINSImprove),
         GradStrong = as.numeric(GradStrong),
         SufficientlyPrepared = as.numeric(SufficientlyPrepared))
FacWritingAttitude %>%
  gather(-Gender, key = "var", value = "value", na.rm=TRUE) %>%
  ggplot() +
  geom_boxplot(aes(y = Gender, x = value)) +
  facet_wrap(~ var, scales = "free")
## Warning: attributes are not identical across measure variables;
## they will be dropped
## Warning: Removed 18 rows containing non-finite values (stat_boxplot).

Boxplot: School

FacWritingAttitude <- select(FacWriting, c(32,33,34,35,37,38,40,41))%>%
  mutate(WACTimprove = as.numeric(WACTimprove),
         JINSImprove = as.numeric(JINSImprove),
         GradStrong = as.numeric(GradStrong),
         SufficientlyPrepared = as.numeric(SufficientlyPrepared),
         School = as.numeric(School))
FacWritingAttitude %>%
  gather(-School, key = "var", value = "value", na.rm=TRUE) %>%
  ggplot() +
  geom_boxplot(aes(y = School, x = value)) +
  facet_wrap(~ var, scales = "free")
## Warning: attributes are not identical across measure variables;
## they will be dropped

Boxplot: Title

FacWritingAttitude <- select(FacWriting, c(32,33,34,35,37,38,40,41))%>%
  mutate(WACTimprove = as.numeric(WACTimprove),
         JINSImprove = as.numeric(JINSImprove),
         GradStrong = as.numeric(GradStrong),
         SufficientlyPrepared = as.numeric(SufficientlyPrepared),
         Title = as.numeric(Title))
FacWritingAttitude %>%
  gather(-Title, key = "var", value = "value", na.rm=TRUE) %>%
  ggplot() +
  geom_boxplot(aes(y = Title, x = value)) +
  facet_wrap(~ var, scales = "free")
## Warning: attributes are not identical across measure variables;
## they will be dropped

Crosstabs

crosstab(FacWritingAttitude, row.vars="WACTimprove", col.vars="Gender", type="f")
##             Gender  0  1 Sum
## WACTimprove                 
## 1                   0  0   0
## 2                   1  3   4
## 3                   7  3  10
## 4                   1  2   3
## 5                   5  4   9
## 6                  19 11  30
## 7                   0  0   0
## 8                   5  3   8
## 9                   7  8  15
## 10                  2  6   8
## Sum                47 40  87
crosstab(FacWritingAttitude, row.vars="WACTimprove", col.vars="TimeAtTruman", type="f")
##             TimeAtTruman  1  2  3  4 Sum
## WACTimprove                             
## 1                         0  0  0  0   0
## 2                         2  0  0  2   4
## 3                         0  1  0  9  10
## 4                         0  0  0  3   3
## 5                         1  2  1  5   9
## 6                         7  1  1 21  30
## 7                         0  0  0  0   0
## 8                         0  2  2  4   8
## 9                         4  1  2  8  15
## 10                        1  2  1  4   8
## Sum                      15  9  7 56  87
crosstab(FacWritingAttitude, row.vars="WACTimprove", col.vars="Title", type="f")
##             Title  1  2  3  4 Sum
## WACTimprove                      
## 1                  2  0  0  0   2
## 2                  0  0  0  4   4
## 3                  0  0  2  8  10
## 4                  0  0  1  2   3
## 5                  0  0  2  7   9
## 6                  0  0  4 26  30
## 7                  1  0  0  0   1
## 8                  0  0  1  7   8
## 9                  0  1  3 11  15
## 10                 0  0  1  7   8
## Sum                3  1 14 72  90
crosstab(FacWritingAttitude, row.vars="WACTimprove", col.vars="School", type="f")
##             School    #NULL! BUS HSE Interdiscipl Other SAL SAM SSCS Sum
## WACTimprove                                                             
## 1                   2      0   0   0            0     0   0   0    0   2
## 2                   0      0   1   1            0     0   0   0    2   4
## 3                   0      0   0   1            1     0   4   3    1  10
## 4                   0      0   0   1            0     0   1   0    1   3
## 5                   0      0   1   2            0     0   2   1    3   9
## 6                   0      1   1   6            0     0   9   8    5  30
## 7                   1      0   0   0            0     0   0   0    0   1
## 8                   0      0   0   1            0     0   3   3    1   8
## 9                   0      0   2   5            0     1   3   3    1  15
## 10                  0      0   0   1            0     1   3   2    1   8
## Sum                 3      1   5  18            1     2  25  20   15  90
crosstab(FacWritingAttitude, row.vars="JINSImprove", col.vars="Gender", type="f")
##             Gender  0  1 Sum
## JINSImprove                 
## 1                   0  0   0
## 2                   1  3   4
## 3                   4  2   6
## 4                   3  2   5
## 5                   7  4  11
## 6                  14 13  27
## 7                   0  0   0
## 8                   9  5  14
## 9                   7  7  14
## 10                  2  4   6
## Sum                47 40  87
crosstab(FacWritingAttitude, row.vars="JINSImprove", col.vars="TimeAtTruman", type="f")
##             TimeAtTruman  1  2  3  4 Sum
## JINSImprove                             
## 1                         0  0  0  0   0
## 2                         2  0  0  2   4
## 3                         0  1  0  5   6
## 4                         0  0  0  5   5
## 5                         0  2  0  9  11
## 6                         8  2  1 16  27
## 7                         0  0  0  0   0
## 8                         2  0  3  9  14
## 9                         2  2  2  8  14
## 10                        1  2  1  2   6
## Sum                      15  9  7 56  87
crosstab(FacWritingAttitude, row.vars="JINSImprove", col.vars="Title", type="f")
##             Title  1  2  3  4 Sum
## JINSImprove                      
## 1                  2  0  0  0   2
## 2                  0  0  0  4   4
## 3                  0  0  1  5   6
## 4                  0  0  0  5   5
## 5                  0  0  1 10  11
## 6                  0  0  3 24  27
## 7                  1  0  0  0   1
## 8                  0  0  4 10  14
## 9                  0  1  3 10  14
## 10                 0  0  2  4   6
## Sum                3  1 14 72  90
crosstab(FacWritingAttitude, row.vars="JINSImprove", col.vars="School", type="f")
##             School    #NULL! BUS HSE Interdiscipl Other SAL SAM SSCS Sum
## JINSImprove                                                             
## 1                   2      0   0   0            0     0   0   0    0   2
## 2                   0      0   1   1            0     0   0   0    2   4
## 3                   0      0   0   1            0     0   3   1    1   6
## 4                   0      0   0   1            0     0   1   1    2   5
## 5                   0      0   2   3            0     0   3   1    2  11
## 6                   0      1   1   5            0     0   8   7    5  27
## 7                   1      0   0   0            0     0   0   0    0   1
## 8                   0      0   1   3            0     1   3   5    1  14
## 9                   0      0   0   4            0     0   6   3    1  14
## 10                  0      0   0   0            1     1   1   2    1   6
## Sum                 3      1   5  18            1     2  25  20   15  90
crosstab(FacWritingAttitude, row.vars="GradStrong", col.vars="Gender", type="f")
##            Gender  0  1 Sum
## GradStrong                 
## 1                  0  0   0
## 2                  1  3   4
## 3                  2  2   4
## 4                  4  3   7
## 5                  4  1   5
## 6                  4  3   7
## 7                  0  0   0
## 8                 17  9  26
## 9                 14 15  29
## 10                 1  4   5
## Sum               47 40  87
crosstab(FacWritingAttitude, row.vars="GradStrong", col.vars="TimeAtTruman", type="f")
##            TimeAtTruman  1  2  3  4 Sum
## GradStrong                             
## 1                        0  0  0  0   0
## 2                        2  0  1  1   4
## 3                        0  1  0  3   4
## 4                        2  0  0  5   7
## 5                        0  2  0  3   5
## 6                        3  0  0  4   7
## 7                        0  0  0  0   0
## 8                        2  4  2 18  26
## 9                        6  2  4 17  29
## 10                       0  0  0  5   5
## Sum                     15  9  7 56  87
crosstab(FacWritingAttitude, row.vars="GradStrong", col.vars="Title", type="f")
##            Title  1  2  3  4 Sum
## GradStrong                      
## 1                 2  0  0  0   2
## 2                 0  0  0  4   4
## 3                 0  0  0  4   4
## 4                 0  0  2  5   7
## 5                 0  0  1  4   5
## 6                 0  0  2  5   7
## 7                 1  0  0  0   1
## 8                 0  1  2 23  26
## 9                 0  0  6 23  29
## 10                0  0  1  4   5
## Sum               3  1 14 72  90
crosstab(FacWritingAttitude, row.vars="GradStrong", col.vars="School", type="f")
##            School    #NULL! BUS HSE Interdiscipl Other SAL SAM SSCS Sum
## GradStrong                                                             
## 1                  2      0   0   0            0     0   0   0    0   2
## 2                  0      0   1   1            0     0   0   1    1   4
## 3                  0      0   0   1            0     0   1   2    0   4
## 4                  0      0   0   1            0     0   3   1    2   7
## 5                  0      0   1   1            0     0   1   1    1   5
## 6                  0      0   0   2            0     0   3   1    1   7
## 7                  1      0   0   0            0     0   0   0    0   1
## 8                  0      0   1   8            0     0   4  10    3  26
## 9                  0      1   2   4            0     2  11   3    6  29
## 10                 0      0   0   0            1     0   2   1    1   5
## Sum                3      1   5  18            1     2  25  20   15  90
crosstab(FacWritingAttitude, row.vars="SufficientlyPrepared", col.vars="Gender", type="f")
##                      Gender  0  1 Sum
## SufficientlyPrepared                 
## 1                            0  0   0
## 2                            2  3   5
## 3                            2  3   5
## 4                            3  0   3
## 5                            2  1   3
## 6                           10  6  16
## 7                            0  0   0
## 8                           10  9  19
## 9                           15 15  30
## 10                           3  3   6
## Sum                         47 40  87
crosstab(FacWritingAttitude, row.vars="SufficientlyPrepared", col.vars="TimeAtTruman", type="f")
##                      TimeAtTruman  1  2  3  4 Sum
## SufficientlyPrepared                             
## 1                                  0  0  0  0   0
## 2                                  2  1  1  1   5
## 3                                  1  1  0  3   5
## 4                                  1  0  0  2   3
## 5                                  0  1  1  1   3
## 6                                  2  1  1 12  16
## 7                                  0  0  0  0   0
## 8                                  4  3  1 11  19
## 9                                  4  2  2 22  30
## 10                                 1  0  1  4   6
## Sum                               15  9  7 56  87
crosstab(FacWritingAttitude, row.vars="SufficientlyPrepared", col.vars="Title", type="f")
##                      Title  1  2  3  4 Sum
## SufficientlyPrepared                      
## 1                           2  0  0  0   2
## 2                           0  0  1  4   5
## 3                           0  0  0  5   5
## 4                           0  0  1  2   3
## 5                           0  0  1  2   3
## 6                           0  0  2 14  16
## 7                           1  0  0  0   1
## 8                           0  0  3 16  19
## 9                           0  1  4 25  30
## 10                          0  0  2  4   6
## Sum                         3  1 14 72  90
crosstab(FacWritingAttitude, row.vars="SufficientlyPrepared", col.vars="School", type="f")
##                      School    #NULL! BUS HSE Interdiscipl Other SAL SAM SSCS Sum
## SufficientlyPrepared                                                             
## 1                            2      0   0   0            0     0   0   0    0   2
## 2                            0      0   1   1            0     0   0   2    1   5
## 3                            0      0   0   2            0     0   1   2    0   5
## 4                            0      0   1   0            0     0   2   0    0   3
## 5                            0      0   0   1            0     0   0   1    1   3
## 6                            0      0   0   1            0     1   6   3    5  16
## 7                            1      0   0   0            0     0   0   0    0   1
## 8                            0      0   1   7            0     1   4   5    1  19
## 9                            0      1   1   4            0     0  12   6    6  30
## 10                           0      0   1   2            1     0   0   1    1   6
## Sum                          3      1   5  18            1     2  25  20   15  90

From all of these boxplots and crosstabs, the thing most interesting to me is that the last set of boxplots pertaining to title. They differ from the others in the fact that they appear to have shorter interquartile ranges on most of the variables. In addition, there are more outlier points than on the other demographic graphs. Each boxplot for each relationship is unique and shows valuable information.

In conclusion, JINS, WACT, and other writing programs are beneficial to Truman students. According to the data, WACT is more beneficial than JINS classes, but not by a statistical amount. All of the programs that Truman has implemented work in improving Truman students’ writing skills and their preparedness for field-based writing.