-
Notifications
You must be signed in to change notification settings - Fork 0
/
connectedness.Rmd
196 lines (160 loc) · 6.45 KB
/
connectedness.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
---
title: "Feeling Connected"
output:
distill::distill_article:
toc: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = T)
```
```{r echo=F}
library(tidyverse)
library(ggthemes)
library(plotly)
```
## Overview
Stilesians were asked:
> _On a scale of 1-10: On average, how connected have you felt to other people in the Stiles community during each time period? (1 = very disconnected, 10 = very connected.) Just answer to your best estimation/memory. First-years, it's ok if your answers are very low for the periods before Fall semester :)._
### Guiding Questions:
* For each year/grade: which time represents the highest connectedness?
* How does connectedness vary between location and enrollment in F20?
* What happens to connectedness over Spring break and Summer?
Also note that the remainder of the year, from November 21 through December, is just assumed to be constant.
### Read Data
```{r}
# Load data
t <- "20201227_235052"
data.connectedness <- read.csv(paste("data/connectedness_", t, ".csv", sep="")) %>%
mutate(Housing.F20=factor(Housing.F20, c("Stiles", "Old Campus", "Off-Campus", "Remote"))) %>%
mutate(Enrolled.F20=case_when(
Enrolled.F20 ~ "Enrolled",
!Enrolled.F20 ~ "Not Enrolled"
)) %>%
mutate(Year=as.factor(Year))
# "Jitter" values just a little bit, so it's easier to see overlapping points
c_jitter <- data.connectedness %>%
mutate(Day=jitter(Day, factor=1)) %>% # x
mutate(Connectedness=jitter(Connectedness, factor=.5)) # y
```
## First Look: Small Multiples
```{r layout="l-page", fig.cap="Vertical columns represent enrollment status in Fall 2020, horizontal rows represent proximity to campus in Fall 2020."}
g_all <- (
ggplot(c_jitter %>% filter(!is.na(Housing.F20) & !is.na(Enrolled.F20) & !is.na(Year)),
aes(x=Day, y=Connectedness, color=Year, group=ID)) +
geom_line(alpha=0.5) +
geom_point(alpha=0.6) +
scale_y_continuous(breaks=1:10) +
scale_x_continuous(breaks=unique(data.connectedness$Day)) +
scale_color_colorblind() +
facet_grid(Housing.F20 ~ Enrolled.F20) +
theme_minimal()
) %>% ggplotly()
g_all
```
Note that you can selectively view graduation years, or groups of graduation years, by clicking on the legend above.
Focus on the Fall semester of 2020: what's going on in Day 327?
Timeline review:
| Epoch (`t=`value) | Time frame | Date range (2020) | Day of Year (Starting) |
|-------------------|------------|-------------------|------------|
| `t1` | Before Spring Break | < 3/7 | 13 |
| `t2` | Spring Break | 3/7 - 3/22 | 67 |
| `t3` | Remainder of the Spring semester| 3/23 - 5/6 | 83 |
| `t4` | Summer | 5/7 - Late August | 128 |
| `t5` | Fall semester, before Break | 8/31 - 11/21 | 244 |
| `t6` | Remainder of the Fall semester | 11/22 - 2020 | 327 |
## Deep Dives
On summary statistics (means and standard errors).
### Graduation Year
```{r}
data.summ.yr <- data.connectedness %>%
filter(!is.na(Housing.F20) & !is.na(Enrolled.F20) & !is.na(Year)) %>%
group_by(Year, Day) %>%
summarize(mean_se(Connectedness), N..Responses=n()) %>%
mutate(Connectedness=y)
dodge <- position_dodge(12)
g <- ggplot(data.summ.yr, aes(x=Day, y=Connectedness, color=Year, text=N..Responses)) +
geom_line(position=dodge) +
geom_errorbar(aes(ymin=ymin, ymax=ymax), position=dodge, width=10) +
scale_y_continuous(breaks=1:10) +
scale_x_continuous(breaks=unique(data.connectedness$Day)) +
scale_color_colorblind() +
theme_minimal()
ggplotly(g)
```
Note that setting tooltips with geom_line is funky.^[https://github.com/ropensci/plotly/issues/1153]
### Proximity to Campus
```{r}
data.summ.yr <- data.connectedness %>%
filter(!is.na(Housing.F20) & !is.na(Enrolled.F20) & !is.na(Year)) %>%
group_by(Housing.F20, Day) %>%
summarize(mean_se(Connectedness), N..Responses=n()) %>%
mutate(Connectedness=y)
dodge <- position_dodge(12)
g <- ggplot(data.summ.yr, aes(x=Day, y=Connectedness, color=Housing.F20, text=N..Responses)) +
geom_line(position=dodge) +
geom_errorbar(aes(ymin=ymin, ymax=ymax), position=dodge, width=10) +
scale_y_continuous(breaks=1:10) +
scale_x_continuous(breaks=unique(data.connectedness$Day)) +
scale_color_colorblind() +
theme_minimal()
ggplotly(g)
```
### Enrollment Status
```{r}
data.summ.yr <- data.connectedness %>%
filter(!is.na(Housing.F20) & !is.na(Enrolled.F20) & !is.na(Year)) %>%
group_by(Enrolled.F20, Day) %>%
summarize(mean_se(Connectedness), N..Responses=n()) %>%
mutate(Connectedness=y)
dodge <- position_dodge(12)
g <- ggplot(data.summ.yr, aes(x=Day, y=Connectedness, color=Enrolled.F20, text=N..Responses)) +
geom_line(position=dodge) +
geom_errorbar(aes(ymin=ymin, ymax=ymax), position=dodge, width=10) +
scale_y_continuous(breaks=1:10) +
scale_x_continuous(breaks=unique(data.connectedness$Day)) +
scale_color_colorblind() +
theme_minimal()
ggplotly(g)
```
## Granular Views
The following plots offer a more granular look at Stiles-connectivity through time from the perspective of each of the following factors: graduation year, proximity to campus in the Fall, and enrollment status in the Fall.
```{r}
g_year <- (
ggplot(c_jitter %>% filter(!is.na(Year)),
aes(x=Day, y=Connectedness, color=Year, group=ID)) +
geom_line(alpha=0.25) +
geom_point(alpha=0.35) +
scale_y_continuous(breaks=1:10) +
scale_x_continuous(breaks=unique(data.connectedness$Day)) +
scale_color_colorblind() +
theme_minimal()
) %>% ggplotly()
g_proximity <- (
ggplot(c_jitter %>% filter(!is.na(Housing.F20)),
aes(x=Day, y=Connectedness, color=Housing.F20, group=ID)) +
geom_line(alpha=0.15) +
geom_point(alpha=0.35) +
scale_y_continuous(breaks=1:10) +
scale_x_continuous(breaks=unique(data.connectedness$Day)) +
scale_color_brewer(palette="Spectral") +
theme_minimal()
) %>% ggplotly()
g_enrollment <- (
ggplot(c_jitter %>% filter(!is.na(Enrolled.F20)),
aes(x=Day, y=Connectedness, color=Enrolled.F20, shape=Enrolled.F20, group=ID)) +
geom_line(alpha=0.25) +
geom_point(alpha=0.35) +
scale_y_continuous(breaks=1:10) +
scale_x_continuous(breaks=unique(data.connectedness$Day)) +
scale_color_colorblind() +
theme_minimal()
) %>% ggplotly()
# https://stackoverflow.com/questions/36227482/r-ggplot-dodging-geom-lines
# https://ggplot2.tidyverse.org/reference/scale_brewer.html
```
```{r}
# subplot(g_year, g_proximity, g_enrollment, shareX=T, nrows=3)
g_year
g_proximity
g_enrollment
```