-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy path.Rhistory
487 lines (487 loc) · 21.7 KB
/
.Rhistory
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
install.packages("foreign")
install.packages("tidyr")
install.packages("dplyr")
install.packages("stringr")
install.packages("ggplot2")
library(foreign) # for reading spss formatted data
library(tidyr)
library(dplyr)
library(stringr) # useful for some string manipulation
library(ggplot2)
d = read.spss("data/Tamiretal2008ReplicationData.sav", to.data.frame=T)
head(d)
View(d)
colnames(d)
## your code here
range(d$Game1Angry1)
View(d)
## your code here
unique(d$Game1Angry1)
tail(d)
colnames(d)
head(d$DoNotUse)
filtered_d = d |>
filter(d$DoNotUse != 1) # your code here: exclude subjects that are marked as "DoNotUse"
filtered_d = d |>
filter(DoNotUse != 1) # your code here: exclude subjects that are marked as "DoNotUse"
filtered_d = d |>
filter(DoNotUse != "1") # your code here: exclude subjects that are marked as "DoNotUse"
unique(d$DoNotUse)
?is.na
index(d$DoNotUse == 1)
?index
?where
?find
which(d$DoNotUse == 1)
?filter
?dplyr::filter
filtered_d = d |>
filter(!is.na(DoNotUse))
filtered_d = d |>
filter(is.na(DoNotUse))
View(d)
filtered_d = filtered_d %>%
select(c("Subject", "Cond"), # Generally important columns for both hypotheses
contains("Game"), # we want all the game columns for hypothesis 1
-contains("Intro"), -c("WhichGames", "GameComments"), # except these
starts_with("DinerDashWith"), c("SOFMusicEnemies", "SOFNoMusicEnemies")) # These columns are for hypothesis 2
rating_hyp_d = filtered_d |>
filter(is.na(DoNotUseVideoGamePerformanceData)) %>% # first, let's get rid of the subjects who did so poorly on one game that their data is unusable
select(-DoNotUseVideoGamePerformanceData, # now get rid of that column
-starts_with("DinerDash"), # and the other columns we don't need
-starts_with("SOF"))
performance_hyp_d = filtered_d |>
select(-starts_with("Games")) # your code here: remove the columns containing "Game" in the name
tiny_demo_d = head(performance_hyp_d, 2) # get just the first two subjects performance data, for a demo
tiny_demo_d
tiny_demo_d |> pivot_longer(cols=-c("Subject", "Cond"), # this tells it to transform all columns *except* these ones
names_to='Measurement',
values_to='Value')
performance_hyp_long_d = performance_hyp_d %>%
pivot_longer(cols=-c("Subject", "Cond"),
names_to='Measurement',
values_to='Score')
head(performance_hyp_long_d)
head(rating_hyp_d)
rating_hyp_long_d = rating_hyp_d %>%
## your code here
pivot_longer(cols=-c("Subject", "Cond"),
names_to='Measurement',
values_to='Rating')
head(rating_hyp_long_d)
head(performance_hyp_long_d)
unique(performance_hyp_long_d$Measurement)
performance_hyp_d = filtered_d |>
select(-starts_with("Game")) # your code here: remove the columns containing "Game" in the name
performance_hyp_long_d = performance_hyp_d %>%
pivot_longer(cols=-c("Subject", "Cond"),
names_to='Measurement',
values_to='Score')
head(performance_hyp_long_d)
performance_hyp_long_d = performance_hyp_long_d %>%
mutate(ConfrontationalGame = grepl("SOF", Measurement), # create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
WithMusic = !grepl("NoMusic|WithoutMusic", Measurement), # creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
MusicCondition = factor(ifelse(Cond > 3, Cond-3, Cond), levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))) # Get rid of uninterpretable condition labels
View(performance_hyp_long_d)
rating_hyp_d = filtered_d |>
filter(is.na(DoNotUseVideoGamePerformanceData)) %>% # first, let's get rid of the subjects who did so poorly on one game that their data is unusable
select(-DoNotUseVideoGamePerformanceData, # now get rid of that column
-starts_with("DinerDash"), # and the other columns we don't need
-starts_with("SOF"))
performance_hyp_d = filtered_d |>
filter(is.na(DoNotUseVideoGamePerformanceData))
performance_hyp_d = filtered_d |>
filter(is.na(DoNotUseVideoGamePerformanceData)) |>
select(-DoNotUseVideoGamePerformanceData,
-starts_with("Game")) # your code here: remove the columns containing "Game" in the name
performance_hyp_long_d = performance_hyp_d %>%
pivot_longer(cols=-c("Subject", "Cond"),
names_to='Measurement',
values_to='Score')
performance_hyp_long_d = performance_hyp_long_d %>%
mutate(ConfrontationalGame = grepl("SOF", Measurement), # create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
WithMusic = !grepl("NoMusic|WithoutMusic", Measurement), # creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
MusicCondition = factor(ifelse(Cond > 3, Cond-3, Cond), levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))) # Get rid of uninterpretable condition labels
View(performance_hyp_long_d)
?head
tiny_demo_mutate <- head(performance_hyp_long_d, 10)
View(tiny_demo_mutate)
?grepl
performance_hyp_long_d_final = performance_hyp_long_d %>%
performance_hyp_long_d_final = performance_hyp_long_d %>%
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
#WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
# Get rid of uninterpretable condition labels
#MusicCondition = factor(ifelse(Cond > 3, Cond-3, Cond), levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
View(performance_hyp_long_d_final)
performance_hyp_long_d = performance_hyp_long_d %>%
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
#WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
# Get rid of uninterpretable condition labels
#MusicCondition = factor(ifelse(Cond > 3, Cond-3, Cond), levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
View(performance_hyp_long_d)
performance_hyp_long_d = performance_hyp_long_d %>%
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
#ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
# Get rid of uninterpretable condition labels
#MusicCondition = factor(ifelse(Cond > 3, Cond-3, Cond), levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
performance_hyp_long_d = performance_hyp_long_d %>%
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
#ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
#WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
# Get rid of uninterpretable condition labels
MusicCondition = factor(ifelse(Cond > 3, Cond-3, Cond), levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
View(performance_hyp_long_d)
performance_hyp_long_d = performance_hyp_long_d |>
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
#ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
#WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
# Get rid of uninterpretable condition labels
MusicCondition = factor(ifelse(Cond > 3, Cond-3, Cond), levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
performance_hyp_long_d = performance_hyp_long_d |>
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
# Get rid of uninterpretable condition labels
MusicCondition = factor(ifelse(Cond > 3, Cond-3, Cond), levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
performance_hyp_long_d = performance_hyp_long_d |>
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
Cond = ifelse(Cond > 3, Cond - 3, Cond),
# Get rid of uninterpretable condition labels
#MusicCondition = factor(ifelse(Cond > 3, Cond-3, Cond), levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
View(performance_hyp_long_d)
library(foreign) # for reading spss formatted data
library(tidyr)
library(dplyr)
library(stringr) # useful for some string manipulation
library(ggplot2)
d = read.spss("data/Tamiretal2008ReplicationData.sav", to.data.frame=T)
head(d)
colnames(d)
## your code here
unique(d$Game1Angry1)
tail(d)
filtered_d = d |>
filter(DoNotUse != 1) # your code here: exclude subjects that are marked as "DoNotUse"
filtered_d = d |>
filter(is.na(DoNotUse))
filtered_d = filtered_d |>
select(c("Subject", "Cond"), # Generally important columns for both hypotheses
contains("Game"), # we want all the game columns for hypothesis 1
-contains("Intro"), -c("WhichGames", "GameComments"), # except these
starts_with("DinerDashWith"), c("SOFMusicEnemies", "SOFNoMusicEnemies")) # These columns are for hypothesis 2
rating_hyp_d = filtered_d |>
filter(is.na(DoNotUseVideoGamePerformanceData)) %>% # first, let's get rid of the subjects who did so poorly on one game that their data is unusable
select(-DoNotUseVideoGamePerformanceData, # now get rid of that column
-starts_with("DinerDash"), # and the other columns we don't need
-starts_with("SOF"))
performance_hyp_d = filtered_d |>
filter(is.na(DoNotUseVideoGamePerformanceData)) |>
select(-DoNotUseVideoGamePerformanceData,
-starts_with("Game")) # your code here: remove the columns containing "Game" in the name
performance_hyp_long_d = performance_hyp_d %>%
pivot_longer(cols=-c("Subject", "Cond"),
names_to='Measurement',
values_to='Score')
head(performance_hyp_long_d)
rating_hyp_long_d = rating_hyp_d %>%
## your code here
pivot_longer(cols=-c("Subject", "Cond"),
names_to='Measurement',
values_to='Rating')
head(rating_hyp_long_d)
performance_hyp_long_d = performance_hyp_long_d |>
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
# Get rid of uninterpretable condition labels
Cond = ifelse(Cond > 3, Cond - 3, Cond),
# Get rid of uninterpretable condition labels
MusicCondition = factor(Cond, levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
View(performance_hyp_long_d)
View(rating_hyp_long_d)
rating_hyp_long_d = rating_hyp_long_d %>%
mutate(
IsRecall = grepl("Friends|Strangers", Measurement),## Your code here
)
?substr
rating_hyp_long_d = rating_hyp_long_d %>%
mutate(
# Pulls out the game number
GameNumber = as.numeric(substr(rating_hyp_long_d$Measurement, 5, 5)),
# We can then use that new GameNumber Column right away
# Games 1 and 2 are confrontational, Games 3 and 4 are not
ConfrontationalGame = GameNumber <= 2,
# Now that we have added the game number and whether it is confrontational elsewhere,
# we can just pull out the emotion! Let's do it in two steps:
# Grab the string of emotions
Emotion = str_extract(Measurement, "Angry|Neutral|Excited|Exciting|Calm"),
# Clean up annoying labeling using TWO ifelse statements
# The data uses "Excited" and "Exciting" to describe the same music
# Similar with "Calm" and "Neutral"
Emotion = ifelse(Emotion == "Excited", "Exciting",
ifelse(Emotion == "Calm", "Neutral", Emotion))
)
View(performance_hyp_d)
performance_hyp_long_d |>
group_by(ConfrontationalGame) %>%
summarize(AvgScore = mean(Score, na.rm=T)) # the na.rm tells R to ignore NA values
performance_hyp_long_d |>
group_by(ConfrontationalGame, WithMusic) %>%
summarize(AvgScore = mean(Score, na.rm=T)) # the na.rm tells R to ignore NA values
performance_hyp_long_d = performance_hyp_long_d |>
group_by(ConfrontationalGame, WithMusic) |> # we're going to compute four sets of z-scores, one for the confrontational game without music, one for the confrontational game with, one for the nonconfrontational game without music, and one for the nonconfrontational game with
mutate(z_scored_performance = scale(Score)) |>
ungroup()
rating_summary_d = rating_hyp_long_d %>%
## your code here
group_by(ConfrontationalGame, Emotion) %>%
summarize(
MeanRating = mean(Rating)
)
rating_summary_d
View(rating_summary_d)
ggplot(rating_summary_d, aes(x=ConfrontationalGame, y=MeanRating, fill=Emotion)) +
geom_bar(position="dodge", stat="identity") +
scale_fill_brewer(palette="Set1")
model = lm(Rating ~ ConfrontationalGame * Emotion, rating_hyp_long_d)
summary(model)
performance_diff_d = performance_hyp_long_d %>%
# re-label variable so code is easier to read
mutate(WithMusic = factor(WithMusic, levels=c(F, T), labels=c("PreMusic", "PostMusic"))) %>%
# now we remove columns we don't need (why might this be?)
select(-c("Score", "Measurement")) %>%
pivot_wider(names_from=WithMusic,
values_from=z_scored_performance) %>%
mutate(ImprovementScore=PostMusic-PreMusic)
performance_diff_d
performance_diff_d = performance_hyp_long_d %>%
# re-label variable so code is easier to read
mutate(WithMusic = factor(WithMusic, levels=c(F, T), labels=c("PreMusic", "PostMusic"))) %>%
# now we remove columns we don't need (why might this be?)
select(-c("Score", "Measurement")) %>%
pivot_wider(names_from=WithMusic,
values_from=z_scored_performance) %>%
mutate(ImprovementScore=PostMusic-PreMusic)
View(performance_diff_d)
performance_diff_d |>
ggplot(aes(x=ConfrontationalGame, y=ImprovementScore, fill=Emotion)) +
geom_bar(position="dodge", stat="identity") +
scale_fill_brewer(palette="Set1")
performance_diff_d |>
ggplot(aes(x=ConfrontationalGame, y=ImprovementScore, fill=MusicCondition)) +
geom_bar(position="dodge", stat="identity") +
scale_fill_brewer(palette="Set1")
performance_diff_d |>
ggplot(aes(x=ConfrontationalGame, y=ImprovementScore, fill=MusicCondition)) +
geom_bar(position="dodge", stat="summary", fun = mean) +
scale_fill_brewer(palette="Set1")
performance_summary_d = performance_diff_d |>
group_by(ConfrontationalGame, MusicCondition) |>
summarize(MeanImprovementScore = mean(ImprovementScore))
performance_summary_d |>
ggplot(aes(x=ConfrontationalGame, y=ImprovementScore, fill=MusicCondition)) +
geom_bar(position="dodge", stat="identity") +
scale_fill_brewer(palette="Set1")
performance_summary_d |>
ggplot(aes(x=ConfrontationalGame, y=MeanImprovementScore, fill=MusicCondition)) +
geom_bar(position="dodge", stat="identity") +
scale_fill_brewer(palette="Set1")
performance_diff_summary_d
performance_summary_d
n <- length(unique(performance_diff_d$Subject))
n_subj <- length(unique(performance_diff_d$Subject))
performance_summary_d = performance_diff_d |>
group_by(ConfrontationalGame, MusicCondition) |>
summarize(MeanImprovementScore = mean(ImprovementScore),
SE = sd(ImprovementScore)/n_subj)
performance_summary_d
?geom_errorbar
performance_summary_d |>
ggplot(aes(x=ConfrontationalGame, y=MeanImprovementScore, fill=MusicCondition)) +
geom_bar(position="dodge", stat="identity") +
geom_errorbar(aes(ymin=MeanImprovementScore-SE, ymax=MeanImprovementScore+SE), width=.2,
position=position_dodge(.9))
library(foreign) # for reading spss formatted data
library(tidyr)
library(dplyr)
library(stringr) # useful for some string manipulation
library(ggplot2)
d = read.spss("data/Tamiretal2008ReplicationData.sav", to.data.frame=T)
head(d)
colnames(d)
## your code here
unique(d$Game1Angry1)
filtered_d = filtered_d |>
select(c("Subject", "Cond"), # Generally important columns for both hypotheses
contains("Game"), # we want all the game columns for hypothesis 1
-contains("Intro"), -c("WhichGames", "GameComments"), # except these
starts_with("DinerDashWith"), c("SOFMusicEnemies", "SOFNoMusicEnemies")) # These columns are for hypothesis 2
d = read.spss("data/Tamiretal2008ReplicationData.sav", to.data.frame=T)
library(foreign) # for reading spss formatted data
library(tidyr)
library(dplyr)
library(stringr) # useful for some string manipulation
library(ggplot2)
d = read.spss("data/Tamiretal2008ReplicationData.sav", to.data.frame=T)
View(d)
View(d)
head(d)
View(d)
colnames(d)
## your code here
unique(d$Game1Angry1)
tail(d)
View(d)
head(d$DoNotUse)
filtered_d = d |>
filter(DoNotUse != 1)
View(filtered_d)
?dplyr::filter
unique(d$DoNotUse)
filtered_d = d |>
filter(is.na(DoNotUse))
View(filtered_d)
View(d)
View(filtered_d)
filtered_d = filtered_d |>
select(c("Subject", "Cond"), # Generally important columns for both hypotheses
contains("Game"), # we want all the game columns for hypothesis 1
-contains("Intro"), -c("WhichGames", "GameComments"), # except these
starts_with("DinerDashWith"), c("SOFMusicEnemies", "SOFNoMusicEnemies")) # These columns are for hypothesis 2
View(filtered_d)
head(filtered_d$SOFMusicEnemies)
rating_hyp_d = filtered_d |>
filter(is.na(DoNotUseVideoGamePerformanceData)) %>% # first, let's get rid of the subjects who did so poorly on one game that their data is unusable
select(-DoNotUseVideoGamePerformanceData, # now get rid of that column
-starts_with("DinerDash"), # and the other columns we don't need
-starts_with("SOF"))
View(rating_hyp_d)
performance_hyp_d = filtered_d |>
filter(is.na(DoNotUseVideoGamePerformanceData)) |>
select(c("Subj","Cond"),
-contains("Game")) # your code here: remove the columns containing "Game" in the name
performance_hyp_d = filtered_d |>
filter(is.na(DoNotUseVideoGamePerformanceData)) |>
select(c("Subject","Cond"),
-contains("Game")) # your code here: remove the columns containing "Game" in the name
View(performance_hyp_d)
performance_hyp_d = filtered_d |>
filter(is.na(DoNotUseVideoGamePerformanceData)) |>
select(c("Subject","Cond"),
-starts_with("Game")) # your code here: remove the columns containing "Game" in the name
performance_hyp_d = filtered_d |>
filter(is.na(DoNotUseVideoGamePerformanceData)) |>
select(-DoNotUseVideoGamePerformanceData,
-starts_with("Game")) # your code here: remove the columns containing "Game" in the name
View(performance_hyp_d)
tiny_demo_d = head(performance_hyp_d, 2) # get just the first two subjects performance data, for a demo
tiny_demo_d
tiny_demo_d |> pivot_longer(cols=-c("Subject", "Cond"), # this tells it to transform all columns *except* these ones
names_to='Measurement',
values_to='Value')
performance_hyp_long_d = performance_hyp_d |>
pivot_longer(cols=-c("Subject", "Cond"),
names_to='Measurement',
values_to='Score')
View(performance_hyp_long_d)
head(performance_hyp_long_d)
View(rating_hyp_d)
rating_hyp_long_d = rating_hyp_d |>
pivot_longer(cols=-c("Subject","Cond"),
names_to = "Measurement",
values_to = "Rating")
View(rating_hyp_long_d)
tiny_demo_mutate <- head(performance_hyp_long_d, 10)
tiny_demo_mutate
tiny_demo_mutate = tiny_demo_mutate |>
mutate(
even_score = mod(Score,2)
)
tiny_demo_mutate = tiny_demo_mutate |>
mutate(
score_plus_one = Score + 1
)
View(tiny_demo_mutate)
tiny_demo_mutate = tiny_demo_mutate |>
mutate(
score_plus_one = Score + 1,
score_minus_one = Score - 1
)
View(performance_hyp_long_d)
performance_hyp_long_d = performance_hyp_long_d |>
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
#WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
# Get rid of uninterpretable condition labels
#Cond = ifelse(Cond > 3, Cond - 3, Cond),
# Get rid of uninterpretable condition labels
#MusicCondition = factor(Cond, levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
performance_hyp_long_d = performance_hyp_long_d |>
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
#ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
# Get rid of uninterpretable condition labels
#Cond = ifelse(Cond > 3, Cond - 3, Cond),
# Get rid of uninterpretable condition labels
#MusicCondition = factor(Cond, levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
?ifeles
?ifelse
performance_hyp_long_d = performance_hyp_long_d |>
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
#ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
#WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
# Get rid of uninterpretable condition labels
Cond = ifelse(Cond > 3, Cond - 3, Cond),
# Get rid of uninterpretable condition labels
#MusicCondition = factor(Cond, levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
performance_hyp_long_d = performance_hyp_long_d |>
mutate(
# create a new variable that will say whether the measurement was of the game soldier of fortune (SOF).
#ConfrontationalGame = grepl("SOF", Measurement),
# creates a new column named WithMusic, which is False if the measurement contains *either* "NoMusic" or "WithoutMusic"
#WithMusic = !grepl("NoMusic|WithoutMusic", Measurement),
# Get rid of uninterpretable condition labels
#Cond = ifelse(Cond > 3, Cond - 3, Cond),
# Get rid of uninterpretable condition labels
MusicCondition = factor(Cond, levels = 1:3, labels = c("Anger", "Exciting", "Neutral"))
)
View(performance_hyp_long_d)