In this assignment we’ll learn about dplyr and tidyr, two packages from the tidyverse that allow elegant and easily understandable data tidying and manipulation. We’ll do this by working through the steps of loading an actual dataset, tidying it up, and carrying out some basic analyses.
The dataset we’re using comes from the OSF Reproduciblity project replication of a study by Maya Tamir, Christopher Mitchell, and our very own James Gross (“Hedonic and Instrumental Motives in Anger Regulation,” Tamir, Mitchell, and Gross, Psychological Science, 2008). You can find the replication report here, and the original paper here. The replication tests two hypotheses from the original paper:
Rating hypothesis: Participants will prefer listening to angry music (or recalling an anger-inducing experience) before playing a confrontational (violent) game, but will prefer listening to exciting or neutral music (or recalling a calm experience) before a neutral game. This is assessed through preference ratings where the participants read a description of a game, and then are asked to rate on a likert scale.
Performance hypothesis: Subjects would perform better after listening to angry music on a confrontational game (not one of the ones described in the materials for the previous hypothesis, to avoid contamination), but would perform better on a non-confrontational game (again, not described in the materials for hypothesis 1) after listening to non-angry music. This is computed by having the subjects play without music for 5 minutes, and then after/with music for 5 minutes, and comparing change scores depending on the music type.
First, let’s load the libraries we’re going to use.
library(foreign) # for reading spss formatted data
library(tidyr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(stringr) # useful for some string manipulation
library(ggplot2)
d = read.spss("data/Tamiretal2008ReplicationData.sav", to.data.frame=T)
Take a look at the data structure:
head(d)
## Subject Cond Exper
## 1 1 2 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 2 2 3 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 3 3 1 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 4 4 4 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 5 5 5 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 6 6 6 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## Inifile Date Time Game1Angry1 Game1Angry2 Game1Angry3
## 1 default.mlp 13642819200 40781 6 6 5
## 2 default.mlp 13642819200 50753 7 7 7
## 3 default.mlp 13642819200 54540 6 5 7
## 4 default.mlp 13642905600 34952 4 1 1
## 5 default.mlp 13642905600 49095 6 6 7
## 6 default.mlp 13642905600 59714 5 5 6
## Game1AngryFriends Game1AngryStrangers Game1CalmFriends
## 1 2 5 2
## 2 7 7 6
## 3 2 2 2
## 4 6 6 2
## 5 6 6 2
## 6 3 4 5
## Game1CalmStrangers Game1ExcitedFriends Game1ExcitedStrangers
## 1 2 1 2
## 2 6 6 6
## 3 2 2 2
## 4 1 3 4
## 5 2 5 5
## 6 4 6 4
## Game1Exciting1 Game1Exciting2 Game1Exciting3 Game1Intro Game1Neutral1
## 1 3 2 6 ok 2
## 2 5 3 2 ok 1
## 3 2 3 4 ok 1
## 4 5 4 5 ok 1
## 5 1 3 2 ok 3
## 6 3 2 4 ok 2
## Game1Neutral2 Game1Neutral3 Game2Angry1 Game2Angry2 Game2Angry3
## 1 4 4 6 4 6
## 2 1 1 7 6 7
## 3 2 3 5 3 6
## 4 2 2 6 2 6
## 5 2 4 5 6 6
## 6 2 4 6 5 6
## Game2AngryFriends Game2AngryStrangers Game2CalmFriends
## 1 3 6 1
## 2 6 7 2
## 3 3 3 3
## 4 3 6 1
## 5 5 6 1
## 6 3 5 3
## Game2CalmStrangers Game2ExcitedFriends Game2ExcitedStrangers
## 1 2 1 1
## 2 3 5 5
## 3 3 3 3
## 4 1 2 4
## 5 1 4 4
## 6 2 5 4
## Game2Exciting1 Game2Exciting2 Game2Exciting3 Game2Intro Game2Neutral1
## 1 3 2 4 ok 1
## 2 5 2 1 ok 1
## 3 2 5 2 ok 4
## 4 3 2 2 ok 1
## 5 1 2 2 ok 4
## 6 2 2 3 ok 2
## Game2Neutral2 Game2Neutral3 Game3Angry1 Game3Angry2 Game3Angry3
## 1 3 1 2 2 3
## 2 1 2 6 3 5
## 3 3 1 2 2 3
## 4 1 3 2 1 6
## 5 4 5 3 5 6
## 6 3 4 2 2 5
## Game3AngryFriends Game3AngryStrangers Game3CalmFriends
## 1 3 2 7
## 2 3 2 6
## 3 4 4 3
## 4 5 4 2
## 5 1 3 5
## 6 1 1 4
## Game3CalmStrangers Game3ExcitedFriends Game3ExcitedStrangers
## 1 6 6 5
## 2 5 6 5
## 3 3 4 4
## 4 2 5 6
## 5 5 6 5
## 6 3 4 2
## Game3Exciting1 Game3Exciting2 Game3Exciting3 Game3Intro Game3Neutral1
## 1 2 2 3 ok 5
## 2 4 3 3 ok 2
## 3 3 6 2 ok 2
## 4 3 1 3 ok 2
## 5 3 1 3 ok 2
## 6 1 2 2 ok 5
## Game3Neutral2 Game3Neutral3 Game4Angry1 Game4Angry2 Game4Angry3
## 1 6 5 2 2 2
## 2 1 5 2 5 2
## 3 3 3 5 2 2
## 4 2 6 1 1 2
## 5 4 5 3 4 3
## 6 4 4 2 3 3
## Game4AngryFriends Game4AngryStrangers Game4CalmFriends
## 1 2 2 5
## 2 4 4 2
## 3 4 5 2
## 4 1 1 2
## 5 2 3 5
## 6 1 2 4
## Game4CalmStrangers Game4ExcitedFriends Game4ExcitedStrangers
## 1 5 7 4
## 2 4 3 4
## 3 4 4 5
## 4 2 4 4
## 5 5 5 6
## 6 4 5 4
## Game4Exciting1 Game4Exciting2 Game4Exciting3 Game4Intro Game4Neutral1
## 1 5 5 2 ok 1
## 2 1 2 6 ok 5
## 3 7 4 5 ok 3
## 4 6 6 6 ok 4
## 5 1 5 5 ok 4
## 6 2 4 3 ok 3
## Game4Neutral2 Game4Neutral3 MusicSelectionEnd MusicSelectionInstrx
## 1 5 2 ok ok
## 2 5 2 ok ok
## 3 2 4 ok ok
## 4 5 2 ok ok
## 5 2 5 ok ok
## 6 5 5 ok ok
## RecallSelectionEnd RecallSelectionInstrx Subject2 Cond2
## 1 ok ok 1 2
## 2 ok ok 2 3
## 3 ok ok 3 1
## 4 ok ok 4 4
## 5 ok ok 5 5
## 6 ok ok 6 6
## Exper_A Inifile_A
## 1 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 2 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 3 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 4 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 5 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 6 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## Date_A Time_A DescribeMusic HowActiveAngry1 HowActiveAngry2
## 1 13642819200 43151 2 4 4
## 2 13642819200 53012 3 5 5
## 3 13642819200 57041 2 4 4
## 4 13642905600 37630 3 5 3
## 5 13642905600 51434 2 5 4
## 6 13642905600 62320 3 3 3
## HowActiveAngry3 HowActiveExciting1 HowActiveExciting2 HowActiveExciting3
## 1 4 5 4 5
## 2 5 5 2 4
## 3 4 2 1 3
## 4 3 5 5 5
## 5 5 3 3 3
## 6 2 3 3 4
## HowActiveNeutral1 HowActiveNeutral2 HowActiveNeutral3 HowAngryAngry1
## 1 2 2 2 5
## 2 2 2 1 5
## 3 1 2 1 4
## 4 2 2 1 3
## 5 2 1 1 2
## 6 1 2 1 2
## HowAngryAngry2 HowAngryAngry3 HowAngryExciting1 HowAngryExciting2
## 1 4 4 3 4
## 2 5 5 4 3
## 3 4 4 3 1
## 4 2 3 1 1
## 5 2 3 2 2
## 6 2 2 2 1
## HowAngryExciting3 HowAngryNeutral1 HowAngryNeutral2 HowAngryNeutral3
## 1 3 2 2 1
## 2 3 2 1 1
## 3 3 1 1 2
## 4 1 2 1 1
## 5 1 1 1 1
## 6 1 1 1 1
## HowExcitedAngry1 HowExcitedAngry2 HowExcitedAngry3 HowExcitedExciting1
## 1 4 3 3 4
## 2 5 5 5 4
## 3 3 3 2 2
## 4 4 1 3 4
## 5 4 4 5 3
## 6 5 2 3 3
## HowExcitedExciting2 HowExcitedExciting3 HowExcitedNeutral1
## 1 4 4 2
## 2 2 4 3
## 3 2 3 2
## 4 3 5 2
## 5 3 3 2
## 6 2 4 1
## HowExcitedNeutral2 HowExcitedNeutral3 HowPleasantAngry1
## 1 2 2 1
## 2 2 1 1
## 3 1 2 2
## 4 2 1 1
## 5 1 3 4
## 6 1 2 2
## HowPleasantAngry2 HowPleasantAngry3 HowPleasantExciting1
## 1 2 1 2
## 2 2 1 1
## 3 2 4 2
## 4 1 3 4
## 5 3 2 1
## 6 2 3 3
## HowPleasantExciting2 HowPleasantExciting3 HowPleasantNeutral1
## 1 2 1 5
## 2 4 3 4
## 3 2 2 2
## 4 4 3 2
## 5 1 2 1
## 6 3 4 3
## HowPleasantNeutral2 HowPleasantNeutral3 MusicRatingEnd MusicRatingInstrx
## 1 4 5 ok ok
## 2 4 4 ok ok
## 3 2 1 ok ok
## 4 4 5 ok ok
## 5 1 5 ok ok
## 6 3 4 ok ok
## WhichGames aboutyou age distractions endinstructions ethnicity
## 1 ok ok 18 ok ok 2
## 2 ok ok 20 ok ok 2
## 3 ok ok 18 ok ok 2
## 4 ok ok 18 ok ok 2
## 5 ok ok 18 ok ok 2
## 6 ok ok 19 ok ok 2
## overlooking race sex whatabout year Subject3 DDNoMusicLevel
## 1 ok 2 1 ok 1 1 3
## 2 ok 2 2 ok 2 2 3
## 3 ok 2 1 ok 1 3 2
## 4 ok 2 1 ok 1 4 3
## 5 ok 2 1 ok 1 5 3
## 6 ok 2 1 ok 1 6 3
## DDNoMusicScore DDMusicLevel DDMusicScore SOFNoMusicEnemies
## 1 0 3 830 22
## 2 20 3 2930 18
## 3 1250 3 370 15
## 4 1742 3 1921 3
## 5 60 3 1750 18
## 6 840 3 1380 23
## SOFNoMusicFriendlies SOFNoMusicTime SOFMusicEnemies SOFMusicFriendlies
## 1 2 24360 19 0
## 2 1 23580 18 2
## 3 0 15300 23 1
## 4 0 5280 19 0
## 5 2 19140 23 3
## 6 1 23220 24 0
## SOFMusicTime GameComments
## 1 23340
## 2 22500
## 3 24300
## 4 16860 Participant died, restart
## 5 20820 Error in game towards the end of time
## 6 23400
## DoNotUseVideoGamePerformanceData ConfrontationalAngryMusicScore
## 1 NA 5.500000
## 2 NA 6.833333
## 3 NA 5.333333
## 4 1 3.333333
## 5 1 6.000000
## 6 NA 5.500000
## ConfrontationalExcitingMusicScore ConfrontationalNeutralMusicScore
## 1 3.333333 2.500000
## 2 3.000000 1.166667
## 3 3.000000 2.333333
## 4 3.500000 1.666667
## 5 1.833333 3.666667
## 6 2.666667 2.833333
## ConfrontationalAngryRecallScore ConfrontationalExcitingRecallScore
## 1 3.75 1.25
## 2 7.00 5.75
## 3 2.25 2.25
## 4 6.00 3.50
## 5 6.00 4.75
## 6 3.75 5.00
## ConfrontationalNeutralRecallScore NonconfrontationalAngryMusicScore
## 1 2.00 2.166667
## 2 5.25 3.833333
## 3 2.25 2.666667
## 4 1.50 2.166667
## 5 1.75 4.000000
## 6 4.00 2.833333
## NonconfrontationalExcitingMusicScore NonconfrontationalNeutralMusicScore
## 1 3.166667 4.000000
## 2 3.166667 3.333333
## 3 4.500000 2.833333
## 4 4.166667 3.500000
## 5 3.000000 3.666667
## 6 2.333333 4.333333
## NonconfrontationalAngryRecallScore NonconfrontationalExcitingRecallScore
## 1 2.50 5.25
## 2 3.00 5.25
## 3 4.25 4.25
## 4 3.75 5.00
## 5 2.00 5.75
## 6 1.25 3.50
## NonconfrontationalNeutralRecallScore ConfrontationalAngerScore
## 1 6.25 4.8
## 2 5.25 6.9
## 3 3.25 4.1
## 4 2.00 4.4
## 5 5.00 6.0
## 6 3.75 4.8
## ConfrontationalExcitingScore ConfrontationalNeutralScore
## 1 2.5 2.3
## 2 4.1 2.8
## 3 2.7 2.3
## 4 3.5 1.6
## 5 3.0 2.9
## 6 3.6 3.3
## NonconfrontationalAngerScore NonconfrontationalExcitingScore
## 1 2.3 4.0
## 2 3.5 4.0
## 3 3.3 4.4
## 4 2.8 4.5
## 5 3.2 4.1
## 6 2.2 2.8
## NonconfrontationalNeutralScore Usable DoNotUse
## 1 4.9 1 NA
## 2 4.1 0 1
## 3 3.0 1 NA
## 4 2.9 1 NA
## 5 4.2 1 NA
## 6 4.1 1 NA
## ProblemDetails
## 1
## 2 Female participant (this is a males only study)
## 3
## 4
## 5
## 6
## DinerDashWithMusicScore DinerDashWithoutMusicScore MusicCondition
## 1 5830 5000 Exciting
## 2 7930 5020 Neutral
## 3 5370 1250 Anger
## 4 6921 6742 Anger
## 5 6750 5060 Exciting
## 6 6380 5840 Neutral
## ZDinerDashWithMusicScore ZDinerDashWithoutMusicScore ZSOFNoMusicEnemies
## 1 -0.07333283 0.2692740 0.7501199
## 2 NA NA NA
## 3 -0.73344247 -2.8616517 -0.1401958
## 4 1.49227504 1.7236934 -1.6664514
## 5 1.24688645 0.3193688 0.2413681
## 6 0.71592870 0.9706014 0.8773079
## ZSOFMusicEnemies DinerDashDifferenceScore SOFDifferenceScore
## 1 -0.2020329 -0.3426068 -0.95215278
## 2 NA NA NA
## 3 0.3183548 2.1282092 0.45855062
## 4 -0.2020329 -0.2314183 1.46441854
## 5 0.3183548 0.9275176 0.07698673
## 6 0.4484517 -0.2546727 -0.42885618
## PleasantScoreForAngryMusic PleasantScoreForExcitingMusic
## 1 1.333333 1.666667
## 2 1.333333 2.666667
## 3 2.666667 2.000000
## 4 1.666667 3.666667
## 5 3.000000 1.333333
## 6 2.333333 3.333333
## PleasantScoreForNeutralMusic AngryScoreForAngryMusic
## 1 4.666667 4.333333
## 2 4.000000 5.000000
## 3 1.666667 4.000000
## 4 3.666667 2.666667
## 5 2.333333 2.333333
## 6 3.333333 2.000000
## AngryScoreForExcitingMusic AngryScoreForNeutralMusic
## 1 3.333333 1.666667
## 2 3.333333 1.333333
## 3 2.333333 1.333333
## 4 1.000000 1.333333
## 5 1.666667 1.000000
## 6 1.333333 1.000000
## ExcitedScoreForExcitingMusic ExcitedScoreForNeutralMusic
## 1 4.000000 2.000000
## 2 3.333333 2.000000
## 3 2.333333 1.666667
## 4 4.000000 1.666667
## 5 3.000000 2.000000
## 6 3.000000 1.333333
## ActiveScoreForExcitingMusic ActiveScoreForNeutralMusic
## 1 4.666667 2.000000
## 2 3.666667 1.666667
## 3 2.000000 1.333333
## 4 5.000000 1.666667
## 5 3.000000 1.333333
## 6 3.333333 1.333333
## ExcitedScoreForAngryMusic ActiveScoreForAngryMusic
## 1 3.333333 4.000000
## 2 5.000000 5.000000
## 3 2.666667 4.000000
## 4 2.666667 3.666667
## 5 4.333333 4.666667
## 6 3.333333 2.666667
This data is what we call wide form – each subject is a single row, and the columns represent different observations. This is a somewhat inconvenient way of representing the data, for example if we wanted to do the same operation to each likert rating (for example normalize it to be in the range 0-1), we’d have to do it on each of the 40 or so rating columns. To avoid this, our eventual goal will be to convert the data into long form, where each row is a single observation.
For now, take a look at the column names to get a better idea of what all is in the dataset.
colnames(d)
## [1] "Subject"
## [2] "Cond"
## [3] "Exper"
## [4] "Inifile"
## [5] "Date"
## [6] "Time"
## [7] "Game1Angry1"
## [8] "Game1Angry2"
## [9] "Game1Angry3"
## [10] "Game1AngryFriends"
## [11] "Game1AngryStrangers"
## [12] "Game1CalmFriends"
## [13] "Game1CalmStrangers"
## [14] "Game1ExcitedFriends"
## [15] "Game1ExcitedStrangers"
## [16] "Game1Exciting1"
## [17] "Game1Exciting2"
## [18] "Game1Exciting3"
## [19] "Game1Intro"
## [20] "Game1Neutral1"
## [21] "Game1Neutral2"
## [22] "Game1Neutral3"
## [23] "Game2Angry1"
## [24] "Game2Angry2"
## [25] "Game2Angry3"
## [26] "Game2AngryFriends"
## [27] "Game2AngryStrangers"
## [28] "Game2CalmFriends"
## [29] "Game2CalmStrangers"
## [30] "Game2ExcitedFriends"
## [31] "Game2ExcitedStrangers"
## [32] "Game2Exciting1"
## [33] "Game2Exciting2"
## [34] "Game2Exciting3"
## [35] "Game2Intro"
## [36] "Game2Neutral1"
## [37] "Game2Neutral2"
## [38] "Game2Neutral3"
## [39] "Game3Angry1"
## [40] "Game3Angry2"
## [41] "Game3Angry3"
## [42] "Game3AngryFriends"
## [43] "Game3AngryStrangers"
## [44] "Game3CalmFriends"
## [45] "Game3CalmStrangers"
## [46] "Game3ExcitedFriends"
## [47] "Game3ExcitedStrangers"
## [48] "Game3Exciting1"
## [49] "Game3Exciting2"
## [50] "Game3Exciting3"
## [51] "Game3Intro"
## [52] "Game3Neutral1"
## [53] "Game3Neutral2"
## [54] "Game3Neutral3"
## [55] "Game4Angry1"
## [56] "Game4Angry2"
## [57] "Game4Angry3"
## [58] "Game4AngryFriends"
## [59] "Game4AngryStrangers"
## [60] "Game4CalmFriends"
## [61] "Game4CalmStrangers"
## [62] "Game4ExcitedFriends"
## [63] "Game4ExcitedStrangers"
## [64] "Game4Exciting1"
## [65] "Game4Exciting2"
## [66] "Game4Exciting3"
## [67] "Game4Intro"
## [68] "Game4Neutral1"
## [69] "Game4Neutral2"
## [70] "Game4Neutral3"
## [71] "MusicSelectionEnd"
## [72] "MusicSelectionInstrx"
## [73] "RecallSelectionEnd"
## [74] "RecallSelectionInstrx"
## [75] "Subject2"
## [76] "Cond2"
## [77] "Exper_A"
## [78] "Inifile_A"
## [79] "Date_A"
## [80] "Time_A"
## [81] "DescribeMusic"
## [82] "HowActiveAngry1"
## [83] "HowActiveAngry2"
## [84] "HowActiveAngry3"
## [85] "HowActiveExciting1"
## [86] "HowActiveExciting2"
## [87] "HowActiveExciting3"
## [88] "HowActiveNeutral1"
## [89] "HowActiveNeutral2"
## [90] "HowActiveNeutral3"
## [91] "HowAngryAngry1"
## [92] "HowAngryAngry2"
## [93] "HowAngryAngry3"
## [94] "HowAngryExciting1"
## [95] "HowAngryExciting2"
## [96] "HowAngryExciting3"
## [97] "HowAngryNeutral1"
## [98] "HowAngryNeutral2"
## [99] "HowAngryNeutral3"
## [100] "HowExcitedAngry1"
## [101] "HowExcitedAngry2"
## [102] "HowExcitedAngry3"
## [103] "HowExcitedExciting1"
## [104] "HowExcitedExciting2"
## [105] "HowExcitedExciting3"
## [106] "HowExcitedNeutral1"
## [107] "HowExcitedNeutral2"
## [108] "HowExcitedNeutral3"
## [109] "HowPleasantAngry1"
## [110] "HowPleasantAngry2"
## [111] "HowPleasantAngry3"
## [112] "HowPleasantExciting1"
## [113] "HowPleasantExciting2"
## [114] "HowPleasantExciting3"
## [115] "HowPleasantNeutral1"
## [116] "HowPleasantNeutral2"
## [117] "HowPleasantNeutral3"
## [118] "MusicRatingEnd"
## [119] "MusicRatingInstrx"
## [120] "WhichGames"
## [121] "aboutyou"
## [122] "age"
## [123] "distractions"
## [124] "endinstructions"
## [125] "ethnicity"
## [126] "overlooking"
## [127] "race"
## [128] "sex"
## [129] "whatabout"
## [130] "year"
## [131] "Subject3"
## [132] "DDNoMusicLevel"
## [133] "DDNoMusicScore"
## [134] "DDMusicLevel"
## [135] "DDMusicScore"
## [136] "SOFNoMusicEnemies"
## [137] "SOFNoMusicFriendlies"
## [138] "SOFNoMusicTime"
## [139] "SOFMusicEnemies"
## [140] "SOFMusicFriendlies"
## [141] "SOFMusicTime"
## [142] "GameComments"
## [143] "DoNotUseVideoGamePerformanceData"
## [144] "ConfrontationalAngryMusicScore"
## [145] "ConfrontationalExcitingMusicScore"
## [146] "ConfrontationalNeutralMusicScore"
## [147] "ConfrontationalAngryRecallScore"
## [148] "ConfrontationalExcitingRecallScore"
## [149] "ConfrontationalNeutralRecallScore"
## [150] "NonconfrontationalAngryMusicScore"
## [151] "NonconfrontationalExcitingMusicScore"
## [152] "NonconfrontationalNeutralMusicScore"
## [153] "NonconfrontationalAngryRecallScore"
## [154] "NonconfrontationalExcitingRecallScore"
## [155] "NonconfrontationalNeutralRecallScore"
## [156] "ConfrontationalAngerScore"
## [157] "ConfrontationalExcitingScore"
## [158] "ConfrontationalNeutralScore"
## [159] "NonconfrontationalAngerScore"
## [160] "NonconfrontationalExcitingScore"
## [161] "NonconfrontationalNeutralScore"
## [162] "Usable"
## [163] "DoNotUse"
## [164] "ProblemDetails"
## [165] "DinerDashWithMusicScore"
## [166] "DinerDashWithoutMusicScore"
## [167] "MusicCondition"
## [168] "ZDinerDashWithMusicScore"
## [169] "ZDinerDashWithoutMusicScore"
## [170] "ZSOFNoMusicEnemies"
## [171] "ZSOFMusicEnemies"
## [172] "DinerDashDifferenceScore"
## [173] "SOFDifferenceScore"
## [174] "PleasantScoreForAngryMusic"
## [175] "PleasantScoreForExcitingMusic"
## [176] "PleasantScoreForNeutralMusic"
## [177] "AngryScoreForAngryMusic"
## [178] "AngryScoreForExcitingMusic"
## [179] "AngryScoreForNeutralMusic"
## [180] "ExcitedScoreForExcitingMusic"
## [181] "ExcitedScoreForNeutralMusic"
## [182] "ActiveScoreForExcitingMusic"
## [183] "ActiveScoreForNeutralMusic"
## [184] "ExcitedScoreForAngryMusic"
## [185] "ActiveScoreForAngryMusic"
And see if you can figure out what range the likert scores are in. What’s the highest number on the likert scale, and what’s the lowest? (Hint, d$Game1Angry1 is one of the likert rating columns, and you may want to use unique or range or hist)
## your code here
range(d$Game1Angry1, na.rm=TRUE)
## [1] 1 7
Highest number: 7 Lowest number: 1
First, we’ll get rid of rows and columns of the data that we don’t need.
First, we need to filter out any rows that should be excluded. According to the report, there are two exclusions:
“exclude data from participant 2 and participant 23 participant 2 is female, and this is a males only study participant 23 was set up on part 2 of the study (the music ratings) twice and never did part 1”
You can see participant 23’s data and the fact that they did not do part 1 by looking at the last rows of the dataframe:
tail(d)
## Subject Cond Exper
## 86 87 1 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 87 88 6 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 88 89 2 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 89 90 3 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 90 23 NA
## 91 23 NA
## Inifile Date Time Game1Angry1 Game1Angry2 Game1Angry3
## 86 default.mlp 13644633600 40065 1 3 4
## 87 default.mlp 13644633600 51237 7 7 5
## 88 default.mlp 13644633600 54293 7 6 6
## 89 default.mlp 13644633600 58190 5 5 5
## 90 NA NA NA NA NA
## 91 NA NA NA NA NA
## Game1AngryFriends Game1AngryStrangers Game1CalmFriends
## 86 6 7 1
## 87 4 1 4
## 88 7 5 3
## 89 7 7 1
## 90 NA NA NA
## 91 NA NA NA
## Game1CalmStrangers Game1ExcitedFriends Game1ExcitedStrangers
## 86 1 1 1
## 87 4 7 4
## 88 2 7 6
## 89 1 4 1
## 90 NA NA NA
## 91 NA NA NA
## Game1Exciting1 Game1Exciting2 Game1Exciting3 Game1Intro Game1Neutral1
## 86 1 1 1 ok 2
## 87 7 7 6 ok 2
## 88 3 5 2 ok 1
## 89 1 1 1 ok 1
## 90 NA NA NA NA
## 91 NA NA NA NA
## Game1Neutral2 Game1Neutral3 Game2Angry1 Game2Angry2 Game2Angry3
## 86 2 3 5 5 7
## 87 1 1 7 7 4
## 88 2 1 6 4 6
## 89 1 6 5 1 7
## 90 NA NA NA NA NA
## 91 NA NA NA NA NA
## Game2AngryFriends Game2AngryStrangers Game2CalmFriends
## 86 1 7 4
## 87 1 1 5
## 88 7 2 3
## 89 7 7 1
## 90 NA NA NA
## 91 NA NA NA
## Game2CalmStrangers Game2ExcitedFriends Game2ExcitedStrangers
## 86 4 2 2
## 87 6 7 4
## 88 1 7 5
## 89 1 1 4
## 90 NA NA NA
## 91 NA NA NA
## Game2Exciting1 Game2Exciting2 Game2Exciting3 Game2Intro Game2Neutral1
## 86 5 1 1 ok 1
## 87 7 1 1 ok 1
## 88 1 3 1 ok 1
## 89 3 2 2 ok 1
## 90 NA NA NA NA
## 91 NA NA NA NA
## Game2Neutral2 Game2Neutral3 Game3Angry1 Game3Angry2 Game3Angry3
## 86 1 1 5 3 6
## 87 1 1 2 1 7
## 88 2 2 2 4 4
## 89 3 1 1 1 5
## 90 NA NA NA NA NA
## 91 NA NA NA NA NA
## Game3AngryFriends Game3AngryStrangers Game3CalmFriends
## 86 1 2 5
## 87 1 1 7
## 88 1 1 6
## 89 2 2 7
## 90 NA NA NA
## 91 NA NA NA
## Game3CalmStrangers Game3ExcitedFriends Game3ExcitedStrangers
## 86 6 4 2
## 87 2 7 3
## 88 4 3 6
## 89 6 7 7
## 90 NA NA NA
## 91 NA NA NA
## Game3Exciting1 Game3Exciting2 Game3Exciting3 Game3Intro Game3Neutral1
## 86 1 1 1 ok 5
## 87 2 1 1 ok 4
## 88 5 5 6 ok 4
## 89 2 1 1 ok 4
## 90 NA NA NA NA
## 91 NA NA NA NA
## Game3Neutral2 Game3Neutral3 Game4Angry1 Game4Angry2 Game4Angry3
## 86 1 2 3 1 4
## 87 6 2 2 1 7
## 88 1 6 1 1 1
## 89 4 7 1 3 1
## 90 NA NA NA NA NA
## 91 NA NA NA NA NA
## Game4AngryFriends Game4AngryStrangers Game4CalmFriends
## 86 1 1 7
## 87 3 4 2
## 88 1 1 7
## 89 3 3 5
## 90 NA NA NA
## 91 NA NA NA
## Game4CalmStrangers Game4ExcitedFriends Game4ExcitedStrangers
## 86 7 7 7
## 87 6 7 7
## 88 5 7 5
## 89 4 7 7
## 90 NA NA NA
## 91 NA NA NA
## Game4Exciting1 Game4Exciting2 Game4Exciting3 Game4Intro Game4Neutral1
## 86 2 5 5 ok 5
## 87 4 1 2 ok 5
## 88 5 4 7 ok 5
## 89 2 4 5 ok 1
## 90 NA NA NA NA
## 91 NA NA NA NA
## Game4Neutral2 Game4Neutral3 MusicSelectionEnd MusicSelectionInstrx
## 86 5 4 ok ok
## 87 3 1 ok ok
## 88 5 3 ok ok
## 89 2 5 ok ok
## 90 NA NA
## 91 NA NA
## RecallSelectionEnd RecallSelectionInstrx Subject2 Cond2
## 86 ok ok 87 1
## 87 ok ok 88 6
## 88 ok ok 89 2
## 89 ok ok 90 3
## 90 23 1
## 91 23 1
## Exper_A Inifile_A
## 86 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 87 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 88 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 89 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 90 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 91 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## Date_A Time_A DescribeMusic HowActiveAngry1 HowActiveAngry2
## 86 13644633600 42314 2 5 5
## 87 13644633600 53402 2 5 5
## 88 13644633600 56552 2 5 3
## 89 13644633600 60558 2 5 5
## 90 13643078400 61329 2 4 5
## 91 13643078400 63502 2 4 3
## HowActiveAngry3 HowActiveExciting1 HowActiveExciting2
## 86 4 5 5
## 87 5 5 5
## 88 4 4 5
## 89 3 5 5
## 90 5 3 3
## 91 5 4 3
## HowActiveExciting3 HowActiveNeutral1 HowActiveNeutral2
## 86 5 1 1
## 87 5 2 2
## 88 5 1 2
## 89 5 1 1
## 90 3 3 4
## 91 5 4 4
## HowActiveNeutral3 HowAngryAngry1 HowAngryAngry2 HowAngryAngry3
## 86 1 3 5 1
## 87 1 5 5 1
## 88 1 5 5 4
## 89 1 5 5 3
## 90 3 3 3 2
## 91 2 2 3 2
## HowAngryExciting1 HowAngryExciting2 HowAngryExciting3 HowAngryNeutral1
## 86 1 1 1 1
## 87 3 1 2 1
## 88 2 3 1 1
## 89 3 1 1 1
## 90 3 2 2 2
## 91 3 3 1 2
## HowAngryNeutral2 HowAngryNeutral3 HowExcitedAngry1 HowExcitedAngry2
## 86 5 1 4 4
## 87 1 1 5 5
## 88 1 1 5 5
## 89 1 1 5 5
## 90 2 2 4 4
## 91 2 1 3 3
## HowExcitedAngry3 HowExcitedExciting1 HowExcitedExciting2
## 86 4 3 4
## 87 5 5 5
## 88 4 3 4
## 89 5 4 5
## 90 5 5 5
## 91 3 3 5
## HowExcitedExciting3 HowExcitedNeutral1 HowExcitedNeutral2
## 86 4 1 2
## 87 5 1 5
## 88 5 2 2
## 89 4 1 1
## 90 3 3 4
## 91 4 3 4
## HowExcitedNeutral3 HowPleasantAngry1 HowPleasantAngry2
## 86 1 3 3
## 87 5 1 1
## 88 1 3 3
## 89 2 2 1
## 90 4 1 1
## 91 3 2 2
## HowPleasantAngry3 HowPleasantExciting1 HowPleasantExciting2
## 86 4 2 4
## 87 5 5 5
## 88 2 3 3
## 89 3 1 5
## 90 1 1 2
## 91 1 2 5
## HowPleasantExciting3 HowPleasantNeutral1 HowPleasantNeutral2
## 86 3 3 3
## 87 2 5 5
## 88 5 4 4
## 89 2 4 4
## 90 1 3 3
## 91 3 5 5
## HowPleasantNeutral3 MusicRatingEnd MusicRatingInstrx WhichGames
## 86 2 ok ok ok
## 87 5 ok ok ok
## 88 5 ok ok ok
## 89 5 ok ok ok
## 90 3 ok ok ok
## 91 1 ok ok ok
## aboutyou age distractions endinstructions ethnicity overlooking race
## 86 ok 20 ok ok 2 ok 2
## 87 ok 18 ok ok 2 ok 1
## 88 ok 18 ok ok 2 ok 2
## 89 ok 18 ok ok 2 ok 2
## 90 ok 20 ok ok 2 ok 1
## 91 ok 20 ok ok 2 ok 1
## sex whatabout year Subject3 DDNoMusicLevel DDNoMusicScore DDMusicLevel
## 86 1 ok 2 87 3 0 3
## 87 1 ok 1 88 3 0 3
## 88 1 ok 1 89 2 3280 3
## 89 1 ok 1 90 2 3040 3
## 90 1 ok 2 23 2 3990 3
## 91 1 ok 2 23 NA NA NA
## DDMusicScore SOFNoMusicEnemies SOFNoMusicFriendlies SOFNoMusicTime
## 86 170 15 0 13140
## 87 866 24 0 23460
## 88 820 7 0 8880
## 89 0 22 2 28440
## 90 750 9 2 19260
## 91 NA NA NA NA
## SOFMusicEnemies SOFMusicFriendlies SOFMusicTime
## 86 25 1 23160
## 87 27 0 22380
## 88 31 0 23100
## 89 26 0 25500
## 90 18 2 24120
## 91 NA NA NA
## GameComments DoNotUseVideoGamePerformanceData
## 86 Participant died, restart 1
## 87 NA
## 88 1
## 89 NA
## 90 NA
## 91 NA
## ConfrontationalAngryMusicScore ConfrontationalExcitingMusicScore
## 86 4.166667 1.666667
## 87 6.166667 4.833333
## 88 5.833333 2.500000
## 89 4.666667 1.666667
## 90 NA NA
## 91 NA NA
## ConfrontationalNeutralMusicScore ConfrontationalAngryRecallScore
## 86 1.666667 6.50
## 87 1.166667 2.50
## 88 1.500000 5.25
## 89 2.166667 7.00
## 90 NA NA
## 91 NA NA
## ConfrontationalExcitingRecallScore ConfrontationalNeutralRecallScore
## 86 1.25 1.75
## 87 5.50 4.50
## 88 6.25 2.25
## 89 3.25 1.00
## 90 NA NA
## 91 NA NA
## NonconfrontationalAngryMusicScore NonconfrontationalExcitingMusicScore
## 86 3.666667 2.500000
## 87 3.333333 1.833333
## 88 2.166667 5.333333
## 89 2.000000 2.500000
## 90 NA NA
## 91 NA NA
## NonconfrontationalNeutralMusicScore NonconfrontationalAngryRecallScore
## 86 3.666667 1.25
## 87 3.500000 1.75
## 88 4.000000 1.00
## 89 3.833333 2.25
## 90 NA NA
## 91 NA NA
## NonconfrontationalExcitingRecallScore
## 86 4.25
## 87 6.00
## 88 4.25
## 89 7.00
## 90 NA
## 91 NA
## NonconfrontationalNeutralRecallScore ConfrontationalAngerScore
## 86 5.75 5.1
## 87 5.50 4.7
## 88 5.25 5.6
## 89 6.00 5.6
## 90 NA NA
## 91 NA NA
## ConfrontationalExcitingScore ConfrontationalNeutralScore
## 86 1.5 1.7
## 87 5.1 2.5
## 88 4.0 1.8
## 89 2.3 1.7
## 90 NA NA
## 91 NA NA
## NonconfrontationalAngerScore NonconfrontationalExcitingScore
## 86 2.7 3.2
## 87 2.7 3.5
## 88 1.7 4.9
## 89 2.1 4.3
## 90 NA NA
## 91 NA NA
## NonconfrontationalNeutralScore Usable DoNotUse
## 86 4.5 1 NA
## 87 4.3 1 NA
## 88 4.5 1 NA
## 89 4.7 1 NA
## 90 NA 0 1
## 91 NA 0 1
## ProblemDetails
## 86
## 87
## 88
## 89
## 90 Participant 23 was set up on part 2 of the survey when he was supposed to be set up on part 1; he did part 2 twice; data should be excluded entirely
## 91 Participant 23 was set up on part 2 of the survey when he was supposed to be set up on part 1; he did part 2 twice; data should be excluded entirely
## DinerDashWithMusicScore DinerDashWithoutMusicScore MusicCondition
## 86 5170 5000 Anger
## 87 5866 5000 Neutral
## 88 5820 3280 Exciting
## 89 5000 3040 Neutral
## 90 5750 3990 <NA>
## 91 NA NA <NA>
## ZDinerDashWithMusicScore ZDinerDashWithoutMusicScore ZSOFNoMusicEnemies
## 86 -1.02044667 0.2692740 -0.1401958
## 87 -0.02167208 0.2692740 1.0044959
## 88 -0.08768304 -1.1667773 -1.1576995
## 89 -1.26440023 -1.3671565 0.7501199
## 90 -0.18813451 -0.5739887 -0.9033236
## 91 NA NA NA
## ZSOFMusicEnemies DinerDashDifferenceScore SOFDifferenceScore
## 86 0.5785486 -1.2897207 0.71874445
## 87 0.8387424 -0.2909461 -0.16575340
## 88 1.3591301 1.0790942 2.51682964
## 89 0.7086455 0.1027563 -0.04147439
## 90 -0.3321298 0.3858541 0.57119384
## 91 NA NA NA
## PleasantScoreForAngryMusic PleasantScoreForExcitingMusic
## 86 3.333333 3.000000
## 87 2.333333 4.000000
## 88 2.666667 3.666667
## 89 2.000000 2.666667
## 90 1.000000 1.333333
## 91 1.666667 3.333333
## PleasantScoreForNeutralMusic AngryScoreForAngryMusic
## 86 2.666667 3.000000
## 87 5.000000 3.666667
## 88 4.333333 4.666667
## 89 4.333333 4.333333
## 90 3.000000 2.666667
## 91 3.666667 2.333333
## AngryScoreForExcitingMusic AngryScoreForNeutralMusic
## 86 1.000000 2.333333
## 87 2.000000 1.000000
## 88 2.000000 1.000000
## 89 1.666667 1.000000
## 90 2.333333 2.000000
## 91 2.333333 1.666667
## ExcitedScoreForExcitingMusic ExcitedScoreForNeutralMusic
## 86 3.666667 1.333333
## 87 5.000000 3.666667
## 88 4.000000 1.666667
## 89 4.333333 1.333333
## 90 4.333333 3.666667
## 91 4.000000 3.333333
## ActiveScoreForExcitingMusic ActiveScoreForNeutralMusic
## 86 5.000000 1.000000
## 87 5.000000 1.666667
## 88 4.666667 1.333333
## 89 5.000000 1.000000
## 90 3.000000 3.333333
## 91 4.000000 3.333333
## ExcitedScoreForAngryMusic ActiveScoreForAngryMusic
## 86 4.000000 4.666667
## 87 5.000000 5.000000
## 88 4.666667 4.000000
## 89 5.000000 4.333333
## 90 4.333333 4.666667
## 91 3.000000 4.000000
Notice that participant 23 has missing values for part 1.
The researchers have made a column called DoNotUse based on their exlusion criteria. Use this column to filter the dataframe! (hint: this is a little trickier than it might be because of how R treats NA values. You may want to check out ?is.na.)
filtered_d = d %>%
filter(is.na(DoNotUse)) # your code here: exclude subjects that are marked as "DoNotUse"
It’s good practice to assign a new variable name (in this case filtered_d) to a data frame when you change it in an important way, or apply a code chunk that shouldn’t be run twice. This helps prevent you seeing different results when you run your code in chunks (and might run one multiple times, or skip it, etc.) vs. knit the document.
The dataset contains a bunch of columns we don’t care about:
To get rid of these, we’ll use the select function to take only the columns we need.
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
Even better, let’s split this into separate data frames for hypothesis 1 and hypothesis 2, since they are different types of experiments with different measurements, and therefore different analyses that will need to be performed. Now that we’ve cleaned up the data, this is pretty easy to do! We’ll just drop the columns that are for the other hypothesis. The select function lets us choose which columns to remove (instead of which to keep) by putting a minus sign in front of them. First, let’s create a dataset for the rating hypothesis by getting rid of the game performance columns:
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"))
Now you try! Fill in the selection criteria to get rid of the “Game” columns, which we don’t need for the performance hypothesis. (It’s simpler than the code block above, because you don’t need to do a filter first, only a select.)
performance_hyp_d = filtered_d %>%
select(-contains("Game")) # your code here: remove the columns containing "Game" in the name
Now we want to convert the data to long form, to make the rest of our manipulations easier. To do this, we can gather columns. This will take many columns, and change the column names into entries in a “key” column, while the values that were in the original column will be turned into entries in a “value” column. It’s easiest to see with an example:
tiny_demo_d = head(performance_hyp_d, 2) # get just the first two subjects performance data, for a demo
First, take a look at the original wide-form data:
tiny_demo_d
## Subject Cond DinerDashWithMusicScore DinerDashWithoutMusicScore
## 1 1 2 5830 5000
## 2 3 1 5370 1250
## SOFMusicEnemies SOFNoMusicEnemies
## 1 19 22
## 2 23 15
Now, take a look at the long-form version:
tiny_demo_d %>% gather(Measurement, Value,
-c("Subject", "Cond")) # this tells it to gather all columns *except* these ones.
## Subject Cond Measurement Value
## 1 1 2 DinerDashWithMusicScore 5830
## 2 3 1 DinerDashWithMusicScore 5370
## 3 1 2 DinerDashWithoutMusicScore 5000
## 4 3 1 DinerDashWithoutMusicScore 1250
## 5 1 2 SOFMusicEnemies 19
## 6 3 1 SOFMusicEnemies 23
## 7 1 2 SOFNoMusicEnemies 22
## 8 3 1 SOFNoMusicEnemies 15
See how the columns have been converted into rows (except for the two we excluded), and the dataset has gone from wide to long?
Now let’s actually convert the performance dataset
performance_hyp_long_d = performance_hyp_d %>%
gather(Measurement, Score, -c("Subject", "Cond"))
And you can convert the rating dataset! (Call the “Key” column “Measurement” and call the “Value” column “Rating”, so that the code below will work)
rating_hyp_long_d = rating_hyp_d %>%
gather(Measurement, Rating, -c("Subject", "Cond"))
The measurement column in each dataset now contains a bunch of different types of information. Really, we would like these to be separate columns. For example, we could have one column telling you which video-game it is, and one telling you whether there was music. Tidyverse contains some handy features for splitting columns, but unfortunately the measurement names here are not well suited to it (if the different types of information were always the same length, or were separated by a symbol like “.” or “_“, it would be easy). Thus we’ll have to do a bit of manual testing. We can use the mutate function in dplyr to create new columns as functions of old ones (or alter existing columns). We’ll also use the grepl function, which lets us test whether a regular expression (a fancy type of search pattern) is contained in a column name. For most your purposes, you can probably just use grepl to search for strings, but there are some other quite useful functions in regular expressions, like the”or“” function (|) we use below.
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
performance_hyp_long_d
## Subject Cond Measurement Score ConfrontationalGame
## 1 1 2 DinerDashWithMusicScore 5830 FALSE
## 2 3 1 DinerDashWithMusicScore 5370 FALSE
## 3 4 4 DinerDashWithMusicScore 6921 FALSE
## 4 5 5 DinerDashWithMusicScore 6750 FALSE
## 5 6 6 DinerDashWithMusicScore 6380 FALSE
## 6 7 3 DinerDashWithMusicScore 5170 FALSE
## 7 8 6 DinerDashWithMusicScore 5690 FALSE
## 8 9 5 DinerDashWithMusicScore 6440 FALSE
## 9 10 1 DinerDashWithMusicScore 5480 FALSE
## 10 11 2 DinerDashWithMusicScore 6210 FALSE
## 11 12 4 DinerDashWithMusicScore 6270 FALSE
## 12 13 4 DinerDashWithMusicScore 6150 FALSE
## 13 14 6 DinerDashWithMusicScore 7440 FALSE
## 14 15 2 DinerDashWithMusicScore 5660 FALSE
## 15 16 3 DinerDashWithMusicScore 6810 FALSE
## 16 17 5 DinerDashWithMusicScore 5950 FALSE
## 17 18 1 DinerDashWithMusicScore 6160 FALSE
## 18 19 4 DinerDashWithMusicScore 6240 FALSE
## 19 20 3 DinerDashWithMusicScore 6650 FALSE
## 20 21 6 DinerDashWithMusicScore 6500 FALSE
## 21 22 5 DinerDashWithMusicScore 5770 FALSE
## 22 24 2 DinerDashWithMusicScore 5950 FALSE
## 23 25 2 DinerDashWithMusicScore 5550 FALSE
## 24 26 1 DinerDashWithMusicScore 6560 FALSE
## 25 27 3 DinerDashWithMusicScore 6190 FALSE
## 26 28 4 DinerDashWithMusicScore 5930 FALSE
## 27 29 6 DinerDashWithMusicScore 5990 FALSE
## 28 30 5 DinerDashWithMusicScore 6160 FALSE
## 29 31 4 DinerDashWithMusicScore 5020 FALSE
## 30 32 5 DinerDashWithMusicScore 5000 FALSE
## 31 33 3 DinerDashWithMusicScore 5970 FALSE
## 32 34 1 DinerDashWithMusicScore 6440 FALSE
## 33 35 2 DinerDashWithMusicScore 6010 FALSE
## 34 36 6 DinerDashWithMusicScore 5730 FALSE
## 35 37 1 DinerDashWithMusicScore 5240 FALSE
## 36 38 6 DinerDashWithMusicScore 7430 FALSE
## 37 39 4 DinerDashWithMusicScore 5740 FALSE
## 38 40 3 DinerDashWithMusicScore 5840 FALSE
## 39 41 5 DinerDashWithMusicScore 5790 FALSE
## 40 42 2 DinerDashWithMusicScore 6410 FALSE
## 41 43 6 DinerDashWithMusicScore 7310 FALSE
## 42 44 2 DinerDashWithMusicScore 6460 FALSE
## 43 45 3 DinerDashWithMusicScore 6820 FALSE
## 44 46 1 DinerDashWithMusicScore 5000 FALSE
## 45 47 4 DinerDashWithMusicScore 5100 FALSE
## 46 48 5 DinerDashWithMusicScore 6100 FALSE
## 47 49 5 DinerDashWithMusicScore 5920 FALSE
## 48 50 3 DinerDashWithMusicScore 6170 FALSE
## 49 51 4 DinerDashWithMusicScore 5000 FALSE
## 50 52 1 DinerDashWithMusicScore 5990 FALSE
## 51 53 6 DinerDashWithMusicScore 5670 FALSE
## 52 54 2 DinerDashWithMusicScore 5000 FALSE
## 53 55 4 DinerDashWithMusicScore 5170 FALSE
## 54 56 3 DinerDashWithMusicScore 5990 FALSE
## 55 57 2 DinerDashWithMusicScore 5620 FALSE
## 56 58 5 DinerDashWithMusicScore 6080 FALSE
## 57 59 1 DinerDashWithMusicScore 5830 FALSE
## 58 60 6 DinerDashWithMusicScore 6200 FALSE
## 59 61 3 DinerDashWithMusicScore 6790 FALSE
## 60 62 6 DinerDashWithMusicScore 6130 FALSE
## 61 63 1 DinerDashWithMusicScore 5060 FALSE
## 62 64 2 DinerDashWithMusicScore 6500 FALSE
## 63 65 4 DinerDashWithMusicScore 3460 FALSE
## 64 66 5 DinerDashWithMusicScore 6000 FALSE
## 65 67 4 DinerDashWithMusicScore 5170 FALSE
## 66 68 3 DinerDashWithMusicScore 5650 FALSE
## 67 69 6 DinerDashWithMusicScore 5600 FALSE
## 68 70 2 DinerDashWithMusicScore 5900 FALSE
## 69 71 5 DinerDashWithMusicScore 5660 FALSE
## 70 72 1 DinerDashWithMusicScore 7440 FALSE
## 71 73 1 DinerDashWithMusicScore 6480 FALSE
## 72 74 2 DinerDashWithMusicScore 5430 FALSE
## 73 75 6 DinerDashWithMusicScore 6160 FALSE
## 74 76 5 DinerDashWithMusicScore 5350 FALSE
## 75 77 4 DinerDashWithMusicScore 5060 FALSE
## 76 78 3 DinerDashWithMusicScore 5260 FALSE
## 77 79 6 DinerDashWithMusicScore 5970 FALSE
## 78 80 2 DinerDashWithMusicScore NA FALSE
## 79 81 5 DinerDashWithMusicScore 5670 FALSE
## 80 82 3 DinerDashWithMusicScore 5960 FALSE
## 81 83 4 DinerDashWithMusicScore 5630 FALSE
## 82 84 4 DinerDashWithMusicScore 3290 FALSE
## 83 85 5 DinerDashWithMusicScore 6150 FALSE
## 84 86 3 DinerDashWithMusicScore 5940 FALSE
## 85 87 1 DinerDashWithMusicScore 5170 FALSE
## 86 88 6 DinerDashWithMusicScore 5866 FALSE
## 87 89 2 DinerDashWithMusicScore 5820 FALSE
## 88 90 3 DinerDashWithMusicScore 5000 FALSE
## 89 1 2 DinerDashWithoutMusicScore 5000 FALSE
## 90 3 1 DinerDashWithoutMusicScore 1250 FALSE
## 91 4 4 DinerDashWithoutMusicScore 6742 FALSE
## 92 5 5 DinerDashWithoutMusicScore 5060 FALSE
## 93 6 6 DinerDashWithoutMusicScore 5840 FALSE
## 94 7 3 DinerDashWithoutMusicScore 5020 FALSE
## 95 8 6 DinerDashWithoutMusicScore 5000 FALSE
## 96 9 5 DinerDashWithoutMusicScore 6460 FALSE
## 97 10 1 DinerDashWithoutMusicScore 2990 FALSE
## 98 11 2 DinerDashWithoutMusicScore 5090 FALSE
## 99 12 4 DinerDashWithoutMusicScore 5490 FALSE
## 100 13 4 DinerDashWithoutMusicScore 5140 FALSE
## 101 14 6 DinerDashWithoutMusicScore NA FALSE
## 102 15 2 DinerDashWithoutMusicScore 5000 FALSE
## 103 16 3 DinerDashWithoutMusicScore 5200 FALSE
## 104 17 5 DinerDashWithoutMusicScore 3040 FALSE
## 105 18 1 DinerDashWithoutMusicScore 5140 FALSE
## 106 19 4 DinerDashWithoutMusicScore 5370 FALSE
## 107 20 3 DinerDashWithoutMusicScore 5170 FALSE
## 108 21 6 DinerDashWithoutMusicScore 3000 FALSE
## 109 22 5 DinerDashWithoutMusicScore 5000 FALSE
## 110 24 2 DinerDashWithoutMusicScore 5060 FALSE
## 111 25 2 DinerDashWithoutMusicScore 5000 FALSE
## 112 26 1 DinerDashWithoutMusicScore 5020 FALSE
## 113 27 3 DinerDashWithoutMusicScore 5370 FALSE
## 114 28 4 DinerDashWithoutMusicScore 5000 FALSE
## 115 29 6 DinerDashWithoutMusicScore 5000 FALSE
## 116 30 5 DinerDashWithoutMusicScore 5960 FALSE
## 117 31 4 DinerDashWithoutMusicScore 970 FALSE
## 118 32 5 DinerDashWithoutMusicScore 1090 FALSE
## 119 33 3 DinerDashWithoutMusicScore 5000 FALSE
## 120 34 1 DinerDashWithoutMusicScore 5000 FALSE
## 121 35 2 DinerDashWithoutMusicScore 5000 FALSE
## 122 36 6 DinerDashWithoutMusicScore 5060 FALSE
## 123 37 1 DinerDashWithoutMusicScore 5060 FALSE
## 124 38 6 DinerDashWithoutMusicScore 5840 FALSE
## 125 39 4 DinerDashWithoutMusicScore 5000 FALSE
## 126 40 3 DinerDashWithoutMusicScore 3340 FALSE
## 127 41 5 DinerDashWithoutMusicScore 4189 FALSE
## 128 42 2 DinerDashWithoutMusicScore 5090 FALSE
## 129 43 6 DinerDashWithoutMusicScore 5000 FALSE
## 130 44 2 DinerDashWithoutMusicScore 5170 FALSE
## 131 45 3 DinerDashWithoutMusicScore 5060 FALSE
## 132 46 1 DinerDashWithoutMusicScore 5000 FALSE
## 133 47 4 DinerDashWithoutMusicScore 5000 FALSE
## 134 48 5 DinerDashWithoutMusicScore 5000 FALSE
## 135 49 5 DinerDashWithoutMusicScore 5370 FALSE
## 136 50 3 DinerDashWithoutMusicScore 5680 FALSE
## 137 51 4 DinerDashWithoutMusicScore 5000 FALSE
## 138 52 1 DinerDashWithoutMusicScore 5000 FALSE
## 139 53 6 DinerDashWithoutMusicScore 5530 FALSE
## 140 54 2 DinerDashWithoutMusicScore 3140 FALSE
## 141 55 4 DinerDashWithoutMusicScore 5000 FALSE
## 142 56 3 DinerDashWithoutMusicScore 5000 FALSE
## 143 57 2 DinerDashWithoutMusicScore 2870 FALSE
## 144 58 5 DinerDashWithoutMusicScore 5150 FALSE
## 145 59 1 DinerDashWithoutMusicScore 5000 FALSE
## 146 60 6 DinerDashWithoutMusicScore 5490 FALSE
## 147 61 3 DinerDashWithoutMusicScore 5000 FALSE
## 148 62 6 DinerDashWithoutMusicScore 5210 FALSE
## 149 63 1 DinerDashWithoutMusicScore 2200 FALSE
## 150 64 2 DinerDashWithoutMusicScore 5170 FALSE
## 151 65 4 DinerDashWithoutMusicScore 5000 FALSE
## 152 66 5 DinerDashWithoutMusicScore 5670 FALSE
## 153 67 4 DinerDashWithoutMusicScore 1210 FALSE
## 154 68 3 DinerDashWithoutMusicScore 2960 FALSE
## 155 69 6 DinerDashWithoutMusicScore 5170 FALSE
## 156 70 2 DinerDashWithoutMusicScore 5860 FALSE
## 157 71 5 DinerDashWithoutMusicScore 5000 FALSE
## 158 72 1 DinerDashWithoutMusicScore 5020 FALSE
## 159 73 1 DinerDashWithoutMusicScore 6180 FALSE
## 160 74 2 DinerDashWithoutMusicScore 3160 FALSE
## 161 75 6 DinerDashWithoutMusicScore 5430 FALSE
## 162 76 5 DinerDashWithoutMusicScore 5500 FALSE
## 163 77 4 DinerDashWithoutMusicScore 2180 FALSE
## 164 78 3 DinerDashWithoutMusicScore 5000 FALSE
## 165 79 6 DinerDashWithoutMusicScore 5140 FALSE
## 166 80 2 DinerDashWithoutMusicScore NA FALSE
## 167 81 5 DinerDashWithoutMusicScore 5070 FALSE
## 168 82 3 DinerDashWithoutMusicScore 5060 FALSE
## 169 83 4 DinerDashWithoutMusicScore 5060 FALSE
## 170 84 4 DinerDashWithoutMusicScore 2870 FALSE
## 171 85 5 DinerDashWithoutMusicScore 6000 FALSE
## 172 86 3 DinerDashWithoutMusicScore 5000 FALSE
## 173 87 1 DinerDashWithoutMusicScore 5000 FALSE
## 174 88 6 DinerDashWithoutMusicScore 5000 FALSE
## 175 89 2 DinerDashWithoutMusicScore 3280 FALSE
## 176 90 3 DinerDashWithoutMusicScore 3040 FALSE
## 177 1 2 SOFMusicEnemies 19 TRUE
## 178 3 1 SOFMusicEnemies 23 TRUE
## 179 4 4 SOFMusicEnemies 19 TRUE
## 180 5 5 SOFMusicEnemies 23 TRUE
## 181 6 6 SOFMusicEnemies 24 TRUE
## 182 7 3 SOFMusicEnemies 20 TRUE
## 183 8 6 SOFMusicEnemies 1 TRUE
## 184 9 5 SOFMusicEnemies 16 TRUE
## 185 10 1 SOFMusicEnemies 24 TRUE
## 186 11 2 SOFMusicEnemies 26 TRUE
## 187 12 4 SOFMusicEnemies 23 TRUE
## 188 13 4 SOFMusicEnemies 23 TRUE
## 189 14 6 SOFMusicEnemies 25 TRUE
## 190 15 2 SOFMusicEnemies 10 TRUE
## 191 16 3 SOFMusicEnemies 26 TRUE
## 192 17 5 SOFMusicEnemies 15 TRUE
## 193 18 1 SOFMusicEnemies 23 TRUE
## 194 19 4 SOFMusicEnemies 21 TRUE
## 195 20 3 SOFMusicEnemies 23 TRUE
## 196 21 6 SOFMusicEnemies 14 TRUE
## 197 22 5 SOFMusicEnemies 23 TRUE
## 198 24 2 SOFMusicEnemies 15 TRUE
## 199 25 2 SOFMusicEnemies 27 TRUE
## 200 26 1 SOFMusicEnemies 24 TRUE
## 201 27 3 SOFMusicEnemies 26 TRUE
## 202 28 4 SOFMusicEnemies 1 TRUE
## 203 29 6 SOFMusicEnemies 19 TRUE
## 204 30 5 SOFMusicEnemies 26 TRUE
## 205 31 4 SOFMusicEnemies 14 TRUE
## 206 32 5 SOFMusicEnemies 12 TRUE
## 207 33 3 SOFMusicEnemies 19 TRUE
## 208 34 1 SOFMusicEnemies NA TRUE
## 209 35 2 SOFMusicEnemies 23 TRUE
## 210 36 6 SOFMusicEnemies 24 TRUE
## 211 37 1 SOFMusicEnemies 7 TRUE
## 212 38 6 SOFMusicEnemies 26 TRUE
## 213 39 4 SOFMusicEnemies 0 TRUE
## 214 40 3 SOFMusicEnemies 14 TRUE
## 215 41 5 SOFMusicEnemies 25 TRUE
## 216 42 2 SOFMusicEnemies 23 TRUE
## 217 43 6 SOFMusicEnemies 30 TRUE
## 218 44 2 SOFMusicEnemies 22 TRUE
## 219 45 3 SOFMusicEnemies 23 TRUE
## 220 46 1 SOFMusicEnemies 1 TRUE
## 221 47 4 SOFMusicEnemies 28 TRUE
## 222 48 5 SOFMusicEnemies 25 TRUE
## 223 49 5 SOFMusicEnemies 24 TRUE
## 224 50 3 SOFMusicEnemies 0 TRUE
## 225 51 4 SOFMusicEnemies NA TRUE
## 226 52 1 SOFMusicEnemies 23 TRUE
## 227 53 6 SOFMusicEnemies 24 TRUE
## 228 54 2 SOFMusicEnemies 23 TRUE
## 229 55 4 SOFMusicEnemies 4 TRUE
## 230 56 3 SOFMusicEnemies 17 TRUE
## 231 57 2 SOFMusicEnemies 24 TRUE
## 232 58 5 SOFMusicEnemies 26 TRUE
## 233 59 1 SOFMusicEnemies 23 TRUE
## 234 60 6 SOFMusicEnemies 26 TRUE
## 235 61 3 SOFMusicEnemies 18 TRUE
## 236 62 6 SOFMusicEnemies 23 TRUE
## 237 63 1 SOFMusicEnemies 0 TRUE
## 238 64 2 SOFMusicEnemies 13 TRUE
## 239 65 4 SOFMusicEnemies NA TRUE
## 240 66 5 SOFMusicEnemies 23 TRUE
## 241 67 4 SOFMusicEnemies 27 TRUE
## 242 68 3 SOFMusicEnemies 19 TRUE
## 243 69 6 SOFMusicEnemies 25 TRUE
## 244 70 2 SOFMusicEnemies 28 TRUE
## 245 71 5 SOFMusicEnemies 26 TRUE
## 246 72 1 SOFMusicEnemies 23 TRUE
## 247 73 1 SOFMusicEnemies 36 TRUE
## 248 74 2 SOFMusicEnemies 24 TRUE
## 249 75 6 SOFMusicEnemies 11 TRUE
## 250 76 5 SOFMusicEnemies 25 TRUE
## 251 77 4 SOFMusicEnemies 25 TRUE
## 252 78 3 SOFMusicEnemies 17 TRUE
## 253 79 6 SOFMusicEnemies 20 TRUE
## 254 80 2 SOFMusicEnemies NA TRUE
## 255 81 5 SOFMusicEnemies 27 TRUE
## 256 82 3 SOFMusicEnemies 28 TRUE
## 257 83 4 SOFMusicEnemies 26 TRUE
## 258 84 4 SOFMusicEnemies 19 TRUE
## 259 85 5 SOFMusicEnemies 30 TRUE
## 260 86 3 SOFMusicEnemies 18 TRUE
## 261 87 1 SOFMusicEnemies 25 TRUE
## 262 88 6 SOFMusicEnemies 27 TRUE
## 263 89 2 SOFMusicEnemies 31 TRUE
## 264 90 3 SOFMusicEnemies 26 TRUE
## 265 1 2 SOFNoMusicEnemies 22 TRUE
## 266 3 1 SOFNoMusicEnemies 15 TRUE
## 267 4 4 SOFNoMusicEnemies 3 TRUE
## 268 5 5 SOFNoMusicEnemies 18 TRUE
## 269 6 6 SOFNoMusicEnemies 23 TRUE
## 270 7 3 SOFNoMusicEnemies 7 TRUE
## 271 8 6 SOFNoMusicEnemies 17 TRUE
## 272 9 5 SOFNoMusicEnemies 18 TRUE
## 273 10 1 SOFNoMusicEnemies 16 TRUE
## 274 11 2 SOFNoMusicEnemies 19 TRUE
## 275 12 4 SOFNoMusicEnemies 23 TRUE
## 276 13 4 SOFNoMusicEnemies 2 TRUE
## 277 14 6 SOFNoMusicEnemies 29 TRUE
## 278 15 2 SOFNoMusicEnemies 0 TRUE
## 279 16 3 SOFNoMusicEnemies 24 TRUE
## 280 17 5 SOFNoMusicEnemies 0 TRUE
## 281 18 1 SOFNoMusicEnemies 19 TRUE
## 282 19 4 SOFNoMusicEnemies 15 TRUE
## 283 20 3 SOFNoMusicEnemies 21 TRUE
## 284 21 6 SOFNoMusicEnemies 10 TRUE
## 285 22 5 SOFNoMusicEnemies 21 TRUE
## 286 24 2 SOFNoMusicEnemies 16 TRUE
## 287 25 2 SOFNoMusicEnemies 25 TRUE
## 288 26 1 SOFNoMusicEnemies 24 TRUE
## 289 27 3 SOFNoMusicEnemies 1 TRUE
## 290 28 4 SOFNoMusicEnemies 3 TRUE
## 291 29 6 SOFNoMusicEnemies 10 TRUE
## 292 30 5 SOFNoMusicEnemies 20 TRUE
## 293 31 4 SOFNoMusicEnemies 2 TRUE
## 294 32 5 SOFNoMusicEnemies 12 TRUE
## 295 33 3 SOFNoMusicEnemies 15 TRUE
## 296 34 1 SOFNoMusicEnemies 25 TRUE
## 297 35 2 SOFNoMusicEnemies 25 TRUE
## 298 36 6 SOFNoMusicEnemies 18 TRUE
## 299 37 1 SOFNoMusicEnemies 15 TRUE
## 300 38 6 SOFNoMusicEnemies 24 TRUE
## 301 39 4 SOFNoMusicEnemies 0 TRUE
## 302 40 3 SOFNoMusicEnemies 20 TRUE
## 303 41 5 SOFNoMusicEnemies 15 TRUE
## 304 42 2 SOFNoMusicEnemies 19 TRUE
## 305 43 6 SOFNoMusicEnemies 27 TRUE
## 306 44 2 SOFNoMusicEnemies 24 TRUE
## 307 45 3 SOFNoMusicEnemies 13 TRUE
## 308 46 1 SOFNoMusicEnemies 1 TRUE
## 309 47 4 SOFNoMusicEnemies 27 TRUE
## 310 48 5 SOFNoMusicEnemies 2 TRUE
## 311 49 5 SOFNoMusicEnemies 17 TRUE
## 312 50 3 SOFNoMusicEnemies 17 TRUE
## 313 51 4 SOFNoMusicEnemies 8 TRUE
## 314 52 1 SOFNoMusicEnemies 23 TRUE
## 315 53 6 SOFNoMusicEnemies 25 TRUE
## 316 54 2 SOFNoMusicEnemies 24 TRUE
## 317 55 4 SOFNoMusicEnemies 11 TRUE
## 318 56 3 SOFNoMusicEnemies 9 TRUE
## 319 57 2 SOFNoMusicEnemies 24 TRUE
## 320 58 5 SOFNoMusicEnemies 22 TRUE
## 321 59 1 SOFNoMusicEnemies 23 TRUE
## 322 60 6 SOFNoMusicEnemies 18 TRUE
## 323 61 3 SOFNoMusicEnemies 21 TRUE
## 324 62 6 SOFNoMusicEnemies 21 TRUE
## 325 63 1 SOFNoMusicEnemies 1 TRUE
## 326 64 2 SOFNoMusicEnemies 20 TRUE
## 327 65 4 SOFNoMusicEnemies 13 TRUE
## 328 66 5 SOFNoMusicEnemies 8 TRUE
## 329 67 4 SOFNoMusicEnemies 19 TRUE
## 330 68 3 SOFNoMusicEnemies 21 TRUE
## 331 69 6 SOFNoMusicEnemies 24 TRUE
## 332 70 2 SOFNoMusicEnemies 16 TRUE
## 333 71 5 SOFNoMusicEnemies 19 TRUE
## 334 72 1 SOFNoMusicEnemies 16 TRUE
## 335 73 1 SOFNoMusicEnemies 27 TRUE
## 336 74 2 SOFNoMusicEnemies 24 TRUE
## 337 75 6 SOFNoMusicEnemies 15 TRUE
## 338 76 5 SOFNoMusicEnemies 6 TRUE
## 339 77 4 SOFNoMusicEnemies 15 TRUE
## 340 78 3 SOFNoMusicEnemies 2 TRUE
## 341 79 6 SOFNoMusicEnemies 17 TRUE
## 342 80 2 SOFNoMusicEnemies NA TRUE
## 343 81 5 SOFNoMusicEnemies 21 TRUE
## 344 82 3 SOFNoMusicEnemies 20 TRUE
## 345 83 4 SOFNoMusicEnemies 17 TRUE
## 346 84 4 SOFNoMusicEnemies 7 TRUE
## 347 85 5 SOFNoMusicEnemies 25 TRUE
## 348 86 3 SOFNoMusicEnemies 19 TRUE
## 349 87 1 SOFNoMusicEnemies 15 TRUE
## 350 88 6 SOFNoMusicEnemies 24 TRUE
## 351 89 2 SOFNoMusicEnemies 7 TRUE
## 352 90 3 SOFNoMusicEnemies 22 TRUE
## WithMusic MusicCondition
## 1 TRUE Exciting
## 2 TRUE Anger
## 3 TRUE Anger
## 4 TRUE Exciting
## 5 TRUE Neutral
## 6 TRUE Neutral
## 7 TRUE Neutral
## 8 TRUE Exciting
## 9 TRUE Anger
## 10 TRUE Exciting
## 11 TRUE Anger
## 12 TRUE Anger
## 13 TRUE Neutral
## 14 TRUE Exciting
## 15 TRUE Neutral
## 16 TRUE Exciting
## 17 TRUE Anger
## 18 TRUE Anger
## 19 TRUE Neutral
## 20 TRUE Neutral
## 21 TRUE Exciting
## 22 TRUE Exciting
## 23 TRUE Exciting
## 24 TRUE Anger
## 25 TRUE Neutral
## 26 TRUE Anger
## 27 TRUE Neutral
## 28 TRUE Exciting
## 29 TRUE Anger
## 30 TRUE Exciting
## 31 TRUE Neutral
## 32 TRUE Anger
## 33 TRUE Exciting
## 34 TRUE Neutral
## 35 TRUE Anger
## 36 TRUE Neutral
## 37 TRUE Anger
## 38 TRUE Neutral
## 39 TRUE Exciting
## 40 TRUE Exciting
## 41 TRUE Neutral
## 42 TRUE Exciting
## 43 TRUE Neutral
## 44 TRUE Anger
## 45 TRUE Anger
## 46 TRUE Exciting
## 47 TRUE Exciting
## 48 TRUE Neutral
## 49 TRUE Anger
## 50 TRUE Anger
## 51 TRUE Neutral
## 52 TRUE Exciting
## 53 TRUE Anger
## 54 TRUE Neutral
## 55 TRUE Exciting
## 56 TRUE Exciting
## 57 TRUE Anger
## 58 TRUE Neutral
## 59 TRUE Neutral
## 60 TRUE Neutral
## 61 TRUE Anger
## 62 TRUE Exciting
## 63 TRUE Anger
## 64 TRUE Exciting
## 65 TRUE Anger
## 66 TRUE Neutral
## 67 TRUE Neutral
## 68 TRUE Exciting
## 69 TRUE Exciting
## 70 TRUE Anger
## 71 TRUE Anger
## 72 TRUE Exciting
## 73 TRUE Neutral
## 74 TRUE Exciting
## 75 TRUE Anger
## 76 TRUE Neutral
## 77 TRUE Neutral
## 78 TRUE Exciting
## 79 TRUE Exciting
## 80 TRUE Neutral
## 81 TRUE Anger
## 82 TRUE Anger
## 83 TRUE Exciting
## 84 TRUE Neutral
## 85 TRUE Anger
## 86 TRUE Neutral
## 87 TRUE Exciting
## 88 TRUE Neutral
## 89 FALSE Exciting
## 90 FALSE Anger
## 91 FALSE Anger
## 92 FALSE Exciting
## 93 FALSE Neutral
## 94 FALSE Neutral
## 95 FALSE Neutral
## 96 FALSE Exciting
## 97 FALSE Anger
## 98 FALSE Exciting
## 99 FALSE Anger
## 100 FALSE Anger
## 101 FALSE Neutral
## 102 FALSE Exciting
## 103 FALSE Neutral
## 104 FALSE Exciting
## 105 FALSE Anger
## 106 FALSE Anger
## 107 FALSE Neutral
## 108 FALSE Neutral
## 109 FALSE Exciting
## 110 FALSE Exciting
## 111 FALSE Exciting
## 112 FALSE Anger
## 113 FALSE Neutral
## 114 FALSE Anger
## 115 FALSE Neutral
## 116 FALSE Exciting
## 117 FALSE Anger
## 118 FALSE Exciting
## 119 FALSE Neutral
## 120 FALSE Anger
## 121 FALSE Exciting
## 122 FALSE Neutral
## 123 FALSE Anger
## 124 FALSE Neutral
## 125 FALSE Anger
## 126 FALSE Neutral
## 127 FALSE Exciting
## 128 FALSE Exciting
## 129 FALSE Neutral
## 130 FALSE Exciting
## 131 FALSE Neutral
## 132 FALSE Anger
## 133 FALSE Anger
## 134 FALSE Exciting
## 135 FALSE Exciting
## 136 FALSE Neutral
## 137 FALSE Anger
## 138 FALSE Anger
## 139 FALSE Neutral
## 140 FALSE Exciting
## 141 FALSE Anger
## 142 FALSE Neutral
## 143 FALSE Exciting
## 144 FALSE Exciting
## 145 FALSE Anger
## 146 FALSE Neutral
## 147 FALSE Neutral
## 148 FALSE Neutral
## 149 FALSE Anger
## 150 FALSE Exciting
## 151 FALSE Anger
## 152 FALSE Exciting
## 153 FALSE Anger
## 154 FALSE Neutral
## 155 FALSE Neutral
## 156 FALSE Exciting
## 157 FALSE Exciting
## 158 FALSE Anger
## 159 FALSE Anger
## 160 FALSE Exciting
## 161 FALSE Neutral
## 162 FALSE Exciting
## 163 FALSE Anger
## 164 FALSE Neutral
## 165 FALSE Neutral
## 166 FALSE Exciting
## 167 FALSE Exciting
## 168 FALSE Neutral
## 169 FALSE Anger
## 170 FALSE Anger
## 171 FALSE Exciting
## 172 FALSE Neutral
## 173 FALSE Anger
## 174 FALSE Neutral
## 175 FALSE Exciting
## 176 FALSE Neutral
## 177 TRUE Exciting
## 178 TRUE Anger
## 179 TRUE Anger
## 180 TRUE Exciting
## 181 TRUE Neutral
## 182 TRUE Neutral
## 183 TRUE Neutral
## 184 TRUE Exciting
## 185 TRUE Anger
## 186 TRUE Exciting
## 187 TRUE Anger
## 188 TRUE Anger
## 189 TRUE Neutral
## 190 TRUE Exciting
## 191 TRUE Neutral
## 192 TRUE Exciting
## 193 TRUE Anger
## 194 TRUE Anger
## 195 TRUE Neutral
## 196 TRUE Neutral
## 197 TRUE Exciting
## 198 TRUE Exciting
## 199 TRUE Exciting
## 200 TRUE Anger
## 201 TRUE Neutral
## 202 TRUE Anger
## 203 TRUE Neutral
## 204 TRUE Exciting
## 205 TRUE Anger
## 206 TRUE Exciting
## 207 TRUE Neutral
## 208 TRUE Anger
## 209 TRUE Exciting
## 210 TRUE Neutral
## 211 TRUE Anger
## 212 TRUE Neutral
## 213 TRUE Anger
## 214 TRUE Neutral
## 215 TRUE Exciting
## 216 TRUE Exciting
## 217 TRUE Neutral
## 218 TRUE Exciting
## 219 TRUE Neutral
## 220 TRUE Anger
## 221 TRUE Anger
## 222 TRUE Exciting
## 223 TRUE Exciting
## 224 TRUE Neutral
## 225 TRUE Anger
## 226 TRUE Anger
## 227 TRUE Neutral
## 228 TRUE Exciting
## 229 TRUE Anger
## 230 TRUE Neutral
## 231 TRUE Exciting
## 232 TRUE Exciting
## 233 TRUE Anger
## 234 TRUE Neutral
## 235 TRUE Neutral
## 236 TRUE Neutral
## 237 TRUE Anger
## 238 TRUE Exciting
## 239 TRUE Anger
## 240 TRUE Exciting
## 241 TRUE Anger
## 242 TRUE Neutral
## 243 TRUE Neutral
## 244 TRUE Exciting
## 245 TRUE Exciting
## 246 TRUE Anger
## 247 TRUE Anger
## 248 TRUE Exciting
## 249 TRUE Neutral
## 250 TRUE Exciting
## 251 TRUE Anger
## 252 TRUE Neutral
## 253 TRUE Neutral
## 254 TRUE Exciting
## 255 TRUE Exciting
## 256 TRUE Neutral
## 257 TRUE Anger
## 258 TRUE Anger
## 259 TRUE Exciting
## 260 TRUE Neutral
## 261 TRUE Anger
## 262 TRUE Neutral
## 263 TRUE Exciting
## 264 TRUE Neutral
## 265 FALSE Exciting
## 266 FALSE Anger
## 267 FALSE Anger
## 268 FALSE Exciting
## 269 FALSE Neutral
## 270 FALSE Neutral
## 271 FALSE Neutral
## 272 FALSE Exciting
## 273 FALSE Anger
## 274 FALSE Exciting
## 275 FALSE Anger
## 276 FALSE Anger
## 277 FALSE Neutral
## 278 FALSE Exciting
## 279 FALSE Neutral
## 280 FALSE Exciting
## 281 FALSE Anger
## 282 FALSE Anger
## 283 FALSE Neutral
## 284 FALSE Neutral
## 285 FALSE Exciting
## 286 FALSE Exciting
## 287 FALSE Exciting
## 288 FALSE Anger
## 289 FALSE Neutral
## 290 FALSE Anger
## 291 FALSE Neutral
## 292 FALSE Exciting
## 293 FALSE Anger
## 294 FALSE Exciting
## 295 FALSE Neutral
## 296 FALSE Anger
## 297 FALSE Exciting
## 298 FALSE Neutral
## 299 FALSE Anger
## 300 FALSE Neutral
## 301 FALSE Anger
## 302 FALSE Neutral
## 303 FALSE Exciting
## 304 FALSE Exciting
## 305 FALSE Neutral
## 306 FALSE Exciting
## 307 FALSE Neutral
## 308 FALSE Anger
## 309 FALSE Anger
## 310 FALSE Exciting
## 311 FALSE Exciting
## 312 FALSE Neutral
## 313 FALSE Anger
## 314 FALSE Anger
## 315 FALSE Neutral
## 316 FALSE Exciting
## 317 FALSE Anger
## 318 FALSE Neutral
## 319 FALSE Exciting
## 320 FALSE Exciting
## 321 FALSE Anger
## 322 FALSE Neutral
## 323 FALSE Neutral
## 324 FALSE Neutral
## 325 FALSE Anger
## 326 FALSE Exciting
## 327 FALSE Anger
## 328 FALSE Exciting
## 329 FALSE Anger
## 330 FALSE Neutral
## 331 FALSE Neutral
## 332 FALSE Exciting
## 333 FALSE Exciting
## 334 FALSE Anger
## 335 FALSE Anger
## 336 FALSE Exciting
## 337 FALSE Neutral
## 338 FALSE Exciting
## 339 FALSE Anger
## 340 FALSE Neutral
## 341 FALSE Neutral
## 342 FALSE Exciting
## 343 FALSE Exciting
## 344 FALSE Neutral
## 345 FALSE Anger
## 346 FALSE Anger
## 347 FALSE Exciting
## 348 FALSE Neutral
## 349 FALSE Anger
## 350 FALSE Neutral
## 351 FALSE Exciting
## 352 FALSE Neutral
Now you can help! For the rating dataset, write a test on a measurement name, using grepl or %in% to figure out whether it’s a recall or a music rating. Your new IsRecall column should be true if the measurement name contain either “Friends” or “Strangers”.
rating_hyp_long_d = rating_hyp_long_d %>%
mutate(
IsRecall = grepl("Friends|Strangers", Measurement),## Your code here
)
Here are a couple other useful ways of manipulating columns. (You won’t remember all the functions you see here now, but that’s okay. You can always reference this tutorial later if there’s something you need to figure out how to do.)
rating_hyp_long_d = rating_hyp_long_d %>%
mutate(
GameNumber = as.numeric(substr(rating_hyp_long_d$Measurement, 5, 5)),
ConfrontationalGame = GameNumber <= 2, # in a mutate, we can use a column we created (or changed) right away. Games 1 and 2 are confrontational, games 3 and 4 are not.
Emotion = str_extract(Measurement, "Angry|Neutral|Excited|Exciting|Calm"),
Emotion = ifelse(Emotion == "Excited", "Exciting", # this just gets rid of some annoying labeling choices
ifelse(Emotion == "Calm", "Neutral", Emotion))
)
For the performance data, we need to do a little bit of manipulation of the columns in order to get to the performance measures the experimenters actually used. Because they want to compare changes in performance across games that have very different scoring systems, the easiest solution is to compare z-scores. The way they did this was to z-score performance before music, z-score performance after music, and then create a difference measure which is a difference of z-scores. (To my mind, this is actually not quite the correct way to analyze this data, but like the replication we will follow the original authors.)
We’ll add a new z-scored value column. However, we have to be careful! We want to z-score within groups of the rows, that are all the same type of measurement. For example, we want to z-score the “DinnerDashWithMusic” scores with respect to eachother, but not with respect to the scores from the other game, for example. We can use the group_by function to set groups, and then all the changes we apply will only occur within those groups until we ungroup the dataset.
To make this more concrete, let’s see how the group_by function can let us compute means within different groups, for example mean scores on the two different games.
performance_hyp_long_d %>%
group_by(ConfrontationalGame) %>%
summarize(AvgScore = mean(Score, na.rm=T)) # the na.rm tells R to ignore NA values
## # A tibble: 2 x 2
## ConfrontationalGame AvgScore
## <lgl> <dbl>
## 1 FALSE 5288.
## 2 TRUE 18.3
This makes it clear why we can’t just z-score the games together! The scores are very different between games. So let’s z-score within groups (using the scale function):
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()
The rating hypothesis analysis also requires some grouped manipulation: the experimenters collected repeated measures (ratings in each emotion category and each music/recall category from each game). They then averaged all the ratings that were from a given emotion and game type together to produce a nice summary. Your job is to implement this, calling the new variable MeanRating, and save the summarized data in a new data frame called rating_summary_d. (Hint: use a group_by and a summarize.)
# rating_hyp_long_d
rating_summary_d = rating_hyp_long_d %>%
group_by(ConfrontationalGame, Emotion) %>%
summarise(MeanRating = mean(Rating))
## your code here
Let’s take a look at the result:
rating_summary_d
## # A tibble: 6 x 3
## # Groups: ConfrontationalGame [?]
## ConfrontationalGame Emotion MeanRating
## <lgl> <chr> <dbl>
## 1 FALSE Angry 2.72
## 2 FALSE Exciting 3.97
## 3 FALSE Neutral 3.68
## 4 TRUE Angry 4.68
## 5 TRUE Exciting 3.05
## 6 TRUE Neutral 2.16
And a simple bar plot (don’t worry too much about what exactly this code is doing):
ggplot(rating_summary_d, aes(x=ConfrontationalGame, y=MeanRating, fill=Emotion)) +
geom_bar(position="dodge", stat="identity") +
scale_fill_brewer(palette="Set1")
Up to reordering (and the fact that we didn’t compute error bars), this is a pretty decent replication of Fig. 1 from the original Tamir et al. paper. The ratings were highest for Angry in the confrontational game, and lowest for Angry in the non-confrontational game.
And the long form dataset makes it easy to run a linear model (don’t worry too much about this, we’ll talk more about it in 252).
model = lm(Rating ~ ConfrontationalGame * Emotion, rating_hyp_long_d)
summary(model)
##
## Call:
## lm(formula = Rating ~ ConfrontationalGame * Emotion, data = rating_hyp_long_d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.6787 -1.1553 -0.0468 1.3170 4.8447
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 2.71702 0.07965 34.114
## ConfrontationalGameTRUE 1.96170 0.11264 17.416
## EmotionExciting 1.25319 0.11264 11.126
## EmotionNeutral 0.96596 0.11264 8.576
## ConfrontationalGameTRUE:EmotionExciting -2.88511 0.15929 -18.112
## ConfrontationalGameTRUE:EmotionNeutral -3.48936 0.15929 -21.905
## Pr(>|t|)
## (Intercept) <2e-16 ***
## ConfrontationalGameTRUE <2e-16 ***
## EmotionExciting <2e-16 ***
## EmotionNeutral <2e-16 ***
## ConfrontationalGameTRUE:EmotionExciting <2e-16 ***
## ConfrontationalGameTRUE:EmotionNeutral <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.727 on 2814 degrees of freedom
## Multiple R-squared: 0.1896, Adjusted R-squared: 0.1882
## F-statistic: 131.7 on 5 and 2814 DF, p-value: < 2.2e-16
There are still a few more steps to go for the performance hypothesis. We need to take a difference score to see how people improved from before hearing the music to after, and then see if the improvement is larger if they heard music congruent with the type of game.
To compute the difference score, we have to make our data a bit wider. We now want to subtract the pre-music scores from the post-music scores, which is easiest to do if they are in two different columns. To do this we’ll use the spread function (which is more or less the opposite of gather)
performance_diff_d = performance_hyp_long_d %>%
mutate(WithMusic = factor(WithMusic, levels=c(F, T), labels=c("PreMusic", "PostMusic"))) %>% # first, tweak the variable so our code is easier to read.
select(-c("Score", "Measurement")) %>% # now we remove columns we don't need (bonus: leave them in and see if you can understand what goes wrong!)
spread(WithMusic, z_scored_performance) %>%
mutate(ImprovementScore=PostMusic-PreMusic)
Let’s take a look at the end result:
performance_diff_d
## # A tibble: 176 x 7
## Subject Cond Confrontational… MusicCondition PreMusic PostMusic
## <dbl> <dbl> <lgl> <fct> <dbl> <dbl>
## 1 1 2 FALSE Exciting 0.262 -0.0751
## 2 1 2 TRUE Exciting 0.739 -0.205
## 3 3 1 FALSE Anger -2.86 -0.732
## 4 3 1 TRUE Anger -0.150 0.313
## 5 4 4 FALSE Anger 1.71 1.48
## 6 4 4 TRUE Anger -1.68 -0.205
## 7 5 5 FALSE Exciting 0.311 1.24
## 8 5 5 TRUE Exciting 0.231 0.313
## 9 6 6 FALSE Neutral 0.960 0.710
## 10 6 6 TRUE Neutral 0.866 0.442
## # ... with 166 more rows, and 1 more variable: ImprovementScore <dbl>
If you don’t understand every step of that code (or any other dplyr code), it can be helpful to look at the result of running just the first line, then just the first two lines, and so on.
Now we’re finally to reproduce Fig. 2 from Tamir et al., we just need to get the mean differences within each game and each kind of music, and save them to a variable called MeanImprovementScore:
performance_diff_summary_d = performance_diff_d %>%
filter(!is.na(ImprovementScore)) %>%
group_by(ConfrontationalGame, MusicCondition) %>%
summarise(MeanImprovementScore = mean(ImprovementScore))
## Your code here
Let’s take a look at your result (if it has NA values, how can you fix it?):
performance_diff_summary_d
## # A tibble: 6 x 3
## # Groups: ConfrontationalGame [?]
## ConfrontationalGame MusicCondition MeanImprovementScore
## <lgl> <fct> <dbl>
## 1 FALSE Anger -0.179
## 2 FALSE Exciting -0.0182
## 3 FALSE Neutral 0.114
## 4 TRUE Anger 0.0612
## 5 TRUE Exciting 0.169
## 6 TRUE Neutral -0.225
and plot it!
ggplot(performance_diff_summary_d, aes(x=ConfrontationalGame, y=MeanImprovementScore, fill=MusicCondition)) +
geom_bar(position="dodge", stat="identity") +
scale_fill_brewer(palette="Set1")
(Bonus: also calculate the SEM in the summary data, and then add errorbars to the plot with geom_errorbar!)
Not quite as exact a replication of the effect as Fig. 1. This concurs with the replication report, which says that the hypothesis 1 effect replicated, but hypothesis 2 did not. Here’s a model just for thoroughness (again, don’t worry too much about it):
performance_model = lm(ImprovementScore ~ ConfrontationalGame * MusicCondition, performance_diff_d)
summary(performance_model)
##
## Call:
## lm(formula = ImprovementScore ~ ConfrontationalGame * MusicCondition,
## data = performance_diff_d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.5402 -0.6284 -0.0744 0.6253 2.8550
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) -0.1786 0.1895 -0.942
## ConfrontationalGameTRUE 0.2398 0.2760 0.869
## MusicConditionExciting 0.1603 0.2657 0.603
## MusicConditionNeutral 0.2926 0.2657 1.101
## ConfrontationalGameTRUE:MusicConditionExciting -0.0530 0.3815 -0.139
## ConfrontationalGameTRUE:MusicConditionNeutral -0.5786 0.3800 -1.523
## Pr(>|t|)
## (Intercept) 0.347
## ConfrontationalGameTRUE 0.386
## MusicConditionExciting 0.547
## MusicConditionNeutral 0.272
## ConfrontationalGameTRUE:MusicConditionExciting 0.890
## ConfrontationalGameTRUE:MusicConditionNeutral 0.130
##
## Residual standard error: 1.003 on 164 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.02179, Adjusted R-squared: -0.008033
## F-statistic: 0.7306 on 5 and 164 DF, p-value: 0.6014