-
Notifications
You must be signed in to change notification settings - Fork 0
/
themes.qmd
315 lines (256 loc) · 10.2 KB
/
themes.qmd
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
---
title: "Step 3: Discovering Emergent Themes"
page-layout: full
reference-location: margin
citation-location: margin
bibliography: ref-1.bib
execute:
echo: false
---
```{r}
#| include: false
library(readxl)
library(DT)
library(tidyverse)
studentA <- read_xlsx(
here::here("data", "code_book.xlsx"),
sheet = "studentA"
) %>%
pivot_longer(cols = starts_with("note"),
names_to = "note",
values_to = "notes"
) %>%
drop_na(notes) %>%
pivot_longer(cols = starts_with("theme"),
names_to = "theme",
values_to = "theme_note"
) %>%
drop_na(theme_note) %>%
mutate(notes =
case_when(
note == "note1" & theme == "theme1" ~ notes,
note == "note2" & theme == "theme2" ~ notes,
note == "note3" & theme == "theme3" ~ notes,
note == "note4" & theme == "theme4" ~ notes
)
) %>%
drop_na(notes) %>%
select(code, descriptive_code, theme_note, notes)
studentB <- read_xlsx(
here::here("data", "code_book.xlsx"),
sheet = "studentB"
) %>%
pivot_longer(cols = starts_with("note"),
names_to = "note",
values_to = "notes"
) %>%
drop_na(notes) %>%
pivot_longer(cols = starts_with("theme"),
names_to = "theme",
values_to = "theme_note"
) %>%
drop_na(theme_note) %>%
mutate(notes =
case_when(
note == "note1" & theme == "theme1" ~ notes,
note == "note2" & theme == "theme2" ~ notes,
note == "note3" & theme == "theme3" ~ notes,
note == "note4" & theme == "theme4" ~ notes
)
) %>%
drop_na(notes) %>%
select(code, descriptive_code, theme_note, notes)
students <- full_join(studentA,
studentB,
by = c("code", "descriptive_code", "theme_note", "notes")
)
```
![](images/forest.png){fig-align=center}
In the next stage of coding, often called “pattern coding” [@miles], we group
the descriptive codes made in the previous phase into a smaller number of
categories or themes. Themes or categories "are broad units of information that
consist of several codes aggregated to form a common idea" [@creswell p.194].
These categories can be thought of as somewhat of a meta-code.*[*For
quantitative researchers, this process can be thought of as an analog to
cluster-oriented or factor-oriented approaches in statistical analysis.]{.aside}
Categories should span multiple codes that were previously identified. These
categories "capture some recurring pattern that cuts across your data"
[@merriam, p. 207]. @merriam suggest this process of discovering themes from
codes feels somewhat like constantly transitioning one’s perspective of a
forest, from looking at the “trees” (codes) to the “forest” (themes) and back to
the trees.
## Discoving Themes
As I looked over my descriptive codes, I asked myself what these codes tell me
about the nature of the data science skills students used in their projects.
Some themes immediately jumped out at me, whereas others took a bit of time to
mull over. I'll walk you through my process below.
### "Obvious" Themes
There were two themes I expected to see due to the nature of the project and
the requirements stipulated by the professor. For their project, students were
expected to (1) use an analysis strategy learned in the course and (2) create a
visualization to accompany any analysis and resulting discussion. Thus, I
expected themes of "Data Model" and "Data Visualization" to emerge from the
data.
From my own experiences, I also expected that students would need to perform
some aspect of *data wrangling* to prepare their data for analysis. The data
students used for their project were from their own research, so, although I
knew data wrangling would play some role, I was unsure what type of tasks might
appear in the codes.
### Emergent Themes
While I was looking over the data wrangling tasks students performed in their
projects, I noticed the techniques called upon specific attributes of different
*data structures* (e.g., dataframe, vector, matrix). The implementation of some
tasks was fairly uniform (select variable from dataframe using `$` operator),
whereas other tasks were highly variable. Data filtering was sometimes done with
the `subset()` function, which requires little explicit knowledge of data
structures. However, other times this filtering was carried out using the
`[]` / extraction operator, a technique which requires an understanding of how
extraction differs across different data structures.
I also noticed while looking at the R code for the "Data Model" and "Data
Visualization" themes that certain statements of code included some knowledge
(or lack thereof) regarding the *R Environment*. The most obvious statement that
evoked this theme used `with()` to temporarily attach a dataframe. There were,
however, other statements that also fit into this theme, such as function
arguments being bypassed, sourcing in an external R script, loading in datasets,
and loading in packages.
Within the themes of "Data Model" and "Data Wrangling," I uncovered an
additional theme which speaks to the *efficiency* of a statement of code. The
notion of efficiency came to me from the "don't repeat yourself" principle
[@greg], which recommends scientists modularize their code rather than
copying and pasting and re-use their code instead of rewriting it (p. 2). Thus,
I considered code which adhered to these practices "efficient" and code which
did not adhere to these practices "inefficient."
The final theme I discovered were statements of code whose purpose was more for
a student's *workflow* than anything else. Code comments were my first
indication of this theme, where students used code comments to create sections
of code or flag what was happening in a particular line / lines of code. I
expanded this theme to include statements of code which inspect some
characteristic of an object (e.g., structure of a datafame, names of a
dataframe, summary of a linear model).
## Assigning Descriptive Codes to Themes
For each of the themes outlined above, the associated "atoms" / statements of
code are listed. Keep in mind one statement can apply to two themes! For
example, the code
```linearAnterior <- lm(PADataNoOutlier$Lipid ~ PADataNoOutlier$PSUA)```
applies to three themes. First and foremost, this code uses `lm()` to fit a
linear regression model to the data (*data model*). Second, in order to fit the
data model, the student uses *data wrangling* to select the variables of
interest(`PADataNoOutlier$Lipid`, `PADataNoOutlier$PSUA`). Finally, this code
**does not** make use of the `data = ` argument built in to `lm()`, which
implies a lack of understanding of the function and thus the *R environment*.
### Data Model
::: {.column-margin}
![](images/data-model.png)
:::
*Definition*: Statements of code whose purpose is to create a statistical model
from data.
```{r}
students %>%
filter(theme_note == "data model") %>%
distinct(notes, .keep_all = TRUE) %>%
select(code, descriptive_code, notes) %>%
datatable(class = 'row-border stripe',
colnames = c("R Code", "Descriptive Code", "Additional Notes")
)
```
### Data Visualization
::: {.column-margin}
![](images/visualization.png)
:::
*Definition*: Statements of code whose purpose is to visualize relationships
between variables
**Sub-themes**
- scatterplot
- adding lines to plot
- differentiated colors
- including a legend
- changing plotting environment
- modifying axis labels / plot titles
```{r}
students %>%
filter(theme_note == "data visualization") %>%
distinct(code, .keep_all = TRUE) %>%
select(code, descriptive_code, notes) %>%
datatable(class = 'row-border stripe',
colnames = c("R Code", "Descriptive Code", "Additional Notes")
)
```
### Data Wrangling
::: {.column-margin}
![](images/wrangle.png)
:::
*Definition:* Statements of code whose purpose is to prepare a dataset for
analysis and / or visualization
**Sub-themes**
- selecting variables
- filtering observations
- mutating variables
```{r}
students %>%
filter(theme_note == "data wrangling") %>%
distinct(code, .keep_all = TRUE) %>%
select(code, descriptive_code, notes) %>%
datatable(class = 'row-border stripe',
colnames = c("R Code", "Descriptive Code", "Additional Notes")
)
```
### Data Structures
::: {.column-margin}
![](images/structures.png)
:::
*Definition:* An statement of code which explicitly calls upon attributes of a
data structure (e.g., dataframe, matrix, vector)
```{r}
students %>%
filter(theme_note == "data structures") %>%
distinct(code, .keep_all = TRUE) %>%
select(code, descriptive_code, notes) %>%
datatable(class = 'row-border stripe',
colnames = c("R Code", "Descriptive Code", "Additional Notes")
)
```
### R Environment
::: {.column-margin}
![](images/environment.png)
:::
*Definition:* A statement of code which calls on explicit aspects of the R
environment
```{r}
students %>%
filter(theme_note == "R environment") %>%
distinct(code, .keep_all = TRUE) %>%
select(code, descriptive_code, notes) %>%
datatable(class = 'row-border stripe',
colnames = c("R Code", "Descriptive Code", "Additional Notes")
)
```
### Efficiency / Inefficiency
::: {.column-margin}
![](images/efficient.png)
:::
*Definition:* A statement of code which adheres to the "don't repeat yourself"
principle
```{r}
students %>%
filter(theme_note %in% c("inefficiency", "efficiency")) %>%
distinct(code, .keep_all = TRUE) %>%
select(code, descriptive_code, notes) %>%
datatable(class = 'row-border stripe',
colnames = c("R Code", "Descriptive Code", "Additional Notes")
)
```
### Workflow
::: {.column-margin}
![](images/workflow.png)
:::
*Definition:* A statement of code which facilitates a smooth execution of a
working process
```{r}
students %>%
filter(theme_note == "workflow") %>%
distinct(code, .keep_all = TRUE) %>%
select(code, descriptive_code, notes) %>%
datatable(class = 'row-border stripe',
colnames = c("R Code", "Descriptive Code", "Additional Notes")
)
```