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:

  1. 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.

  2. 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)
library(plotrix)

Load Data

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 Game1CalmStrangers
## 1                 2                   5                2                  2
## 2                 7                   7                6                  6
## 3                 2                   2                2                  2
## 4                 6                   6                2                  1
## 5                 6                   6                2                  2
## 6                 3                   4                5                  4
##   Game1ExcitedFriends Game1ExcitedStrangers Game1Exciting1 Game1Exciting2
## 1                   1                     2              3              2
## 2                   6                     6              5              3
## 3                   2                     2              2              3
## 4                   3                     4              5              4
## 5                   5                     5              1              3
## 6                   6                     4              3              2
##   Game1Exciting3 Game1Intro Game1Neutral1 Game1Neutral2 Game1Neutral3
## 1              6         ok             2             4             4
## 2              2         ok             1             1             1
## 3              4         ok             1             2             3
## 4              5         ok             1             2             2
## 5              2         ok             3             2             4
## 6              4         ok             2             2             4
##   Game2Angry1 Game2Angry2 Game2Angry3 Game2AngryFriends Game2AngryStrangers
## 1           6           4           6                 3                   6
## 2           7           6           7                 6                   7
## 3           5           3           6                 3                   3
## 4           6           2           6                 3                   6
## 5           5           6           6                 5                   6
## 6           6           5           6                 3                   5
##   Game2CalmFriends Game2CalmStrangers Game2ExcitedFriends Game2ExcitedStrangers
## 1                1                  2                   1                     1
## 2                2                  3                   5                     5
## 3                3                  3                   3                     3
## 4                1                  1                   2                     4
## 5                1                  1                   4                     4
## 6                3                  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 Game3CalmStrangers
## 1                 3                   2                7                  6
## 2                 3                   2                6                  5
## 3                 4                   4                3                  3
## 4                 5                   4                2                  2
## 5                 1                   3                5                  5
## 6                 1                   1                4                  3
##   Game3ExcitedFriends Game3ExcitedStrangers Game3Exciting1 Game3Exciting2
## 1                   6                     5              2              2
## 2                   6                     5              4              3
## 3                   4                     4              3              6
## 4                   5                     6              3              1
## 5                   6                     5              3              1
## 6                   4                     2              1              2
##   Game3Exciting3 Game3Intro Game3Neutral1 Game3Neutral2 Game3Neutral3
## 1              3         ok             5             6             5
## 2              3         ok             2             1             5
## 3              2         ok             2             3             3
## 4              3         ok             2             2             6
## 5              3         ok             2             4             5
## 6              2         ok             5             4             4
##   Game4Angry1 Game4Angry2 Game4Angry3 Game4AngryFriends Game4AngryStrangers
## 1           2           2           2                 2                   2
## 2           2           5           2                 4                   4
## 3           5           2           2                 4                   5
## 4           1           1           2                 1                   1
## 5           3           4           3                 2                   3
## 6           2           3           3                 1                   2
##   Game4CalmFriends Game4CalmStrangers Game4ExcitedFriends Game4ExcitedStrangers
## 1                5                  5                   7                     4
## 2                2                  4                   3                     4
## 3                2                  4                   4                     5
## 4                2                  2                   4                     4
## 5                5                  5                   5                     6
## 6                4                  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 HowExcitedNeutral2
## 1                   4                   4                  2                  2
## 2                   2                   4                  3                  2
## 3                   2                   3                  2                  1
## 4                   3                   5                  2                  2
## 5                   3                   3                  2                  1
## 6                   2                   4                  1                  1
##   HowExcitedNeutral3 HowPleasantAngry1 HowPleasantAngry2 HowPleasantAngry3
## 1                  2                 1                 2                 1
## 2                  1                 1                 2                 1
## 3                  2                 2                 2                 4
## 4                  1                 1                 1                 3
## 5                  3                 4                 3                 2
## 6                  2                 2                 2                 3
##   HowPleasantExciting1 HowPleasantExciting2 HowPleasantExciting3
## 1                    2                    2                    1
## 2                    1                    4                    3
## 3                    2                    2                    2
## 4                    4                    4                    3
## 5                    1                    1                    2
## 6                    3                    3                    4
##   HowPleasantNeutral1 HowPleasantNeutral2 HowPleasantNeutral3 MusicRatingEnd
## 1                   5                   4                   5             ok
## 2                   4                   4                   4             ok
## 3                   2                   2                   1             ok
## 4                   2                   4                   5             ok
## 5                   1                   1                   5             ok
## 6                   3                   3                   4             ok
##   MusicRatingInstrx WhichGames aboutyou age distractions endinstructions
## 1                ok         ok       ok  18           ok              ok
## 2                ok         ok       ok  20           ok              ok
## 3                ok         ok       ok  18           ok              ok
## 4                ok         ok       ok  18           ok              ok
## 5                ok         ok       ok  18           ok              ok
## 6                ok         ok       ok  19           ok              ok
##   ethnicity overlooking race sex whatabout year Subject3 DDNoMusicLevel
## 1         2          ok    2   1        ok    1        1              3
## 2         2          ok    2   2        ok    2        2              3
## 3         2          ok    2   1        ok    1        3              2
## 4         2          ok    2   1        ok    1        4              3
## 5         2          ok    2   1        ok    1        5              3
## 6         2          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]

cleaning up a bit

First, we’ll get rid of rows and columns of the data that we don’t need.

filter out excluded rows

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 Game1CalmStrangers
## 86                 6                   7                1                  1
## 87                 4                   1                4                  4
## 88                 7                   5                3                  2
## 89                 7                   7                1                  1
## 90                NA                  NA               NA                 NA
## 91                NA                  NA               NA                 NA
##    Game1ExcitedFriends Game1ExcitedStrangers Game1Exciting1 Game1Exciting2
## 86                   1                     1              1              1
## 87                   7                     4              7              7
## 88                   7                     6              3              5
## 89                   4                     1              1              1
## 90                  NA                    NA             NA             NA
## 91                  NA                    NA             NA             NA
##    Game1Exciting3 Game1Intro Game1Neutral1 Game1Neutral2 Game1Neutral3
## 86              1         ok             2             2             3
## 87              6         ok             2             1             1
## 88              2         ok             1             2             1
## 89              1         ok             1             1             6
## 90             NA                       NA            NA            NA
## 91             NA                       NA            NA            NA
##    Game2Angry1 Game2Angry2 Game2Angry3 Game2AngryFriends Game2AngryStrangers
## 86           5           5           7                 1                   7
## 87           7           7           4                 1                   1
## 88           6           4           6                 7                   2
## 89           5           1           7                 7                   7
## 90          NA          NA          NA                NA                  NA
## 91          NA          NA          NA                NA                  NA
##    Game2CalmFriends Game2CalmStrangers Game2ExcitedFriends
## 86                4                  4                   2
## 87                5                  6                   7
## 88                3                  1                   7
## 89                1                  1                   1
## 90               NA                 NA                  NA
## 91               NA                 NA                  NA
##    Game2ExcitedStrangers Game2Exciting1 Game2Exciting2 Game2Exciting3
## 86                     2              5              1              1
## 87                     4              7              1              1
## 88                     5              1              3              1
## 89                     4              3              2              2
## 90                    NA             NA             NA             NA
## 91                    NA             NA             NA             NA
##    Game2Intro Game2Neutral1 Game2Neutral2 Game2Neutral3 Game3Angry1 Game3Angry2
## 86         ok             1             1             1           5           3
## 87         ok             1             1             1           2           1
## 88         ok             1             2             2           2           4
## 89         ok             1             3             1           1           1
## 90                       NA            NA            NA          NA          NA
## 91                       NA            NA            NA          NA          NA
##    Game3Angry3 Game3AngryFriends Game3AngryStrangers Game3CalmFriends
## 86           6                 1                   2                5
## 87           7                 1                   1                7
## 88           4                 1                   1                6
## 89           5                 2                   2                7
## 90          NA                NA                  NA               NA
## 91          NA                NA                  NA               NA
##    Game3CalmStrangers Game3ExcitedFriends Game3ExcitedStrangers Game3Exciting1
## 86                  6                   4                     2              1
## 87                  2                   7                     3              2
## 88                  4                   3                     6              5
## 89                  6                   7                     7              2
## 90                 NA                  NA                    NA             NA
## 91                 NA                  NA                    NA             NA
##    Game3Exciting2 Game3Exciting3 Game3Intro Game3Neutral1 Game3Neutral2
## 86              1              1         ok             5             1
## 87              1              1         ok             4             6
## 88              5              6         ok             4             1
## 89              1              1         ok             4             4
## 90             NA             NA                       NA            NA
## 91             NA             NA                       NA            NA
##    Game3Neutral3 Game4Angry1 Game4Angry2 Game4Angry3 Game4AngryFriends
## 86             2           3           1           4                 1
## 87             2           2           1           7                 3
## 88             6           1           1           1                 1
## 89             7           1           3           1                 3
## 90            NA          NA          NA          NA                NA
## 91            NA          NA          NA          NA                NA
##    Game4AngryStrangers Game4CalmFriends Game4CalmStrangers Game4ExcitedFriends
## 86                   1                7                  7                   7
## 87                   4                2                  6                   7
## 88                   1                7                  5                   7
## 89                   3                5                  4                   7
## 90                  NA               NA                 NA                  NA
## 91                  NA               NA                 NA                  NA
##    Game4ExcitedStrangers Game4Exciting1 Game4Exciting2 Game4Exciting3
## 86                     7              2              5              5
## 87                     7              4              1              2
## 88                     5              5              4              7
## 89                     7              2              4              5
## 90                    NA             NA             NA             NA
## 91                    NA             NA             NA             NA
##    Game4Intro Game4Neutral1 Game4Neutral2 Game4Neutral3 MusicSelectionEnd
## 86         ok             5             5             4                ok
## 87         ok             5             3             1                ok
## 88         ok             5             5             3                ok
## 89         ok             1             2             5                ok
## 90                       NA            NA            NA                  
## 91                       NA            NA            NA                  
##    MusicSelectionInstrx RecallSelectionEnd RecallSelectionInstrx Subject2 Cond2
## 86                   ok                 ok                    ok       87     1
## 87                   ok                 ok                    ok       88     6
## 88                   ok                 ok                    ok       89     2
## 89                   ok                 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 HowActiveExciting3
## 86               4                  5                  5                  5
## 87               5                  5                  5                  5
## 88               4                  4                  5                  5
## 89               3                  5                  5                  5
## 90               5                  3                  3                  3
## 91               5                  4                  3                  5
##    HowActiveNeutral1 HowActiveNeutral2 HowActiveNeutral3 HowAngryAngry1
## 86                 1                 1                 1              3
## 87                 2                 2                 1              5
## 88                 1                 2                 1              5
## 89                 1                 1                 1              5
## 90                 3                 4                 3              3
## 91                 4                 4                 2              2
##    HowAngryAngry2 HowAngryAngry3 HowAngryExciting1 HowAngryExciting2
## 86              5              1                 1                 1
## 87              5              1                 3                 1
## 88              5              4                 2                 3
## 89              5              3                 3                 1
## 90              3              2                 3                 2
## 91              3              2                 3                 3
##    HowAngryExciting3 HowAngryNeutral1 HowAngryNeutral2 HowAngryNeutral3
## 86                 1                1                5                1
## 87                 2                1                1                1
## 88                 1                1                1                1
## 89                 1                1                1                1
## 90                 2                2                2                2
## 91                 1                2                2                1
##    HowExcitedAngry1 HowExcitedAngry2 HowExcitedAngry3 HowExcitedExciting1
## 86                4                4                4                   3
## 87                5                5                5                   5
## 88                5                5                4                   3
## 89                5                5                5                   4
## 90                4                4                5                   5
## 91                3                3                3                   3
##    HowExcitedExciting2 HowExcitedExciting3 HowExcitedNeutral1
## 86                   4                   4                  1
## 87                   5                   5                  1
## 88                   4                   5                  2
## 89                   5                   4                  1
## 90                   5                   3                  3
## 91                   5                   4                  3
##    HowExcitedNeutral2 HowExcitedNeutral3 HowPleasantAngry1 HowPleasantAngry2
## 86                  2                  1                 3                 3
## 87                  5                  5                 1                 1
## 88                  2                  1                 3                 3
## 89                  1                  2                 2                 1
## 90                  4                  4                 1                 1
## 91                  4                  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 aboutyou age
## 86                   2             ok                ok         ok       ok  20
## 87                   5             ok                ok         ok       ok  18
## 88                   5             ok                ok         ok       ok  18
## 89                   5             ok                ok         ok       ok  18
## 90                   3             ok                ok         ok       ok  20
## 91                   1             ok                ok         ok       ok  20
##    distractions endinstructions ethnicity overlooking race sex whatabout year
## 86           ok              ok         2          ok    2   1        ok    2
## 87           ok              ok         2          ok    1   1        ok    1
## 88           ok              ok         2          ok    2   1        ok    1
## 89           ok              ok         2          ok    2   1        ok    1
## 90           ok              ok         2          ok    1   1        ok    2
## 91           ok              ok         2          ok    1   1        ok    2
##    Subject3 DDNoMusicLevel DDNoMusicScore DDMusicLevel DDMusicScore
## 86       87              3              0            3          170
## 87       88              3              0            3          866
## 88       89              2           3280            3          820
## 89       90              2           3040            3            0
## 90       23              2           3990            3          750
## 91       23             NA             NA           NA           NA
##    SOFNoMusicEnemies SOFNoMusicFriendlies SOFNoMusicTime SOFMusicEnemies
## 86                15                    0          13140              25
## 87                24                    0          23460              27
## 88                 7                    0           8880              31
## 89                22                    2          28440              26
## 90                 9                    2          19260              18
## 91                NA                   NA             NA              NA
##    SOFMusicFriendlies SOFMusicTime                           GameComments
## 86                  1        23160 Participant died, restart             
## 87                  0        22380                                       
## 88                  0        23100                                       
## 89                  0        25500                                       
## 90                  2        24120                                       
## 91                 NA           NA                                       
##    DoNotUseVideoGamePerformanceData ConfrontationalAngryMusicScore
## 86                                1                       4.166667
## 87                               NA                       6.166667
## 88                                1                       5.833333
## 89                               NA                       4.666667
## 90                               NA                             NA
## 91                               NA                             NA
##    ConfrontationalExcitingMusicScore ConfrontationalNeutralMusicScore
## 86                          1.666667                         1.666667
## 87                          4.833333                         1.166667
## 88                          2.500000                         1.500000
## 89                          1.666667                         2.166667
## 90                                NA                               NA
## 91                                NA                               NA
##    ConfrontationalAngryRecallScore ConfrontationalExcitingRecallScore
## 86                            6.50                               1.25
## 87                            2.50                               5.50
## 88                            5.25                               6.25
## 89                            7.00                               3.25
## 90                              NA                                 NA
## 91                              NA                                 NA
##    ConfrontationalNeutralRecallScore NonconfrontationalAngryMusicScore
## 86                              1.75                          3.666667
## 87                              4.50                          3.333333
## 88                              2.25                          2.166667
## 89                              1.00                          2.000000
## 90                                NA                                NA
## 91                                NA                                NA
##    NonconfrontationalExcitingMusicScore NonconfrontationalNeutralMusicScore
## 86                             2.500000                            3.666667
## 87                             1.833333                            3.500000
## 88                             5.333333                            4.000000
## 89                             2.500000                            3.833333
## 90                                   NA                                  NA
## 91                                   NA                                  NA
##    NonconfrontationalAngryRecallScore NonconfrontationalExcitingRecallScore
## 86                               1.25                                  4.25
## 87                               1.75                                  6.00
## 88                               1.00                                  4.25
## 89                               2.25                                  7.00
## 90                                 NA                                    NA
## 91                                 NA                                    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 exclusion 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 use ?unique to check values in the column and check out ?is.na.)

filtered_d = d %>% 
  filter(is.na(DoNotUse)) # your code here: exclude subjects that are marked as "DoNotUse"
head(filtered_d)
##   Subject Cond                                                    Exper
## 1       1    2 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 2       3    1 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 3       4    4 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 4       5    5 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 5       6    6 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 6       7    3 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 54540           6           5           7
## 3 default.mlp 13642905600 34952           4           1           1
## 4 default.mlp 13642905600 49095           6           6           7
## 5 default.mlp 13642905600 59714           5           5           6
## 6 default.mlp 13642905600 59717           6           6           6
##   Game1AngryFriends Game1AngryStrangers Game1CalmFriends Game1CalmStrangers
## 1                 2                   5                2                  2
## 2                 2                   2                2                  2
## 3                 6                   6                2                  1
## 4                 6                   6                2                  2
## 5                 3                   4                5                  4
## 6                 2                   6                6                  1
##   Game1ExcitedFriends Game1ExcitedStrangers Game1Exciting1 Game1Exciting2
## 1                   1                     2              3              2
## 2                   2                     2              2              3
## 3                   3                     4              5              4
## 4                   5                     5              1              3
## 5                   6                     4              3              2
## 6                   1                     1              1              4
##   Game1Exciting3 Game1Intro Game1Neutral1 Game1Neutral2 Game1Neutral3
## 1              6         ok             2             4             4
## 2              4         ok             1             2             3
## 3              5         ok             1             2             2
## 4              2         ok             3             2             4
## 5              4         ok             2             2             4
## 6              1         ok             1             1             1
##   Game2Angry1 Game2Angry2 Game2Angry3 Game2AngryFriends Game2AngryStrangers
## 1           6           4           6                 3                   6
## 2           5           3           6                 3                   3
## 3           6           2           6                 3                   6
## 4           5           6           6                 5                   6
## 5           6           5           6                 3                   5
## 6           7           6           1                 1                   1
##   Game2CalmFriends Game2CalmStrangers Game2ExcitedFriends Game2ExcitedStrangers
## 1                1                  2                   1                     1
## 2                3                  3                   3                     3
## 3                1                  1                   2                     4
## 4                1                  1                   4                     4
## 5                3                  2                   5                     4
## 6                1                  1                   1                     1
##   Game2Exciting1 Game2Exciting2 Game2Exciting3 Game2Intro Game2Neutral1
## 1              3              2              4         ok             1
## 2              2              5              2         ok             4
## 3              3              2              2         ok             1
## 4              1              2              2         ok             4
## 5              2              2              3         ok             2
## 6              1              1              1         ok             1
##   Game2Neutral2 Game2Neutral3 Game3Angry1 Game3Angry2 Game3Angry3
## 1             3             1           2           2           3
## 2             3             1           2           2           3
## 3             1             3           2           1           6
## 4             4             5           3           5           6
## 5             3             4           2           2           5
## 6             1             1           1           3           1
##   Game3AngryFriends Game3AngryStrangers Game3CalmFriends Game3CalmStrangers
## 1                 3                   2                7                  6
## 2                 4                   4                3                  3
## 3                 5                   4                2                  2
## 4                 1                   3                5                  5
## 5                 1                   1                4                  3
## 6                 1                   1                7                  5
##   Game3ExcitedFriends Game3ExcitedStrangers Game3Exciting1 Game3Exciting2
## 1                   6                     5              2              2
## 2                   4                     4              3              6
## 3                   5                     6              3              1
## 4                   6                     5              3              1
## 5                   4                     2              1              2
## 6                   7                     6              1              1
##   Game3Exciting3 Game3Intro Game3Neutral1 Game3Neutral2 Game3Neutral3
## 1              3         ok             5             6             5
## 2              2         ok             2             3             3
## 3              3         ok             2             2             6
## 4              3         ok             2             4             5
## 5              2         ok             5             4             4
## 6              4         ok             6             6             7
##   Game4Angry1 Game4Angry2 Game4Angry3 Game4AngryFriends Game4AngryStrangers
## 1           2           2           2                 2                   2
## 2           5           2           2                 4                   5
## 3           1           1           2                 1                   1
## 4           3           4           3                 2                   3
## 5           2           3           3                 1                   2
## 6           1           3           1                 1                   1
##   Game4CalmFriends Game4CalmStrangers Game4ExcitedFriends Game4ExcitedStrangers
## 1                5                  5                   7                     4
## 2                2                  4                   4                     5
## 3                2                  2                   4                     4
## 4                5                  5                   5                     6
## 5                4                  4                   5                     4
## 6                4                  3                   5                     5
##   Game4Exciting1 Game4Exciting2 Game4Exciting3 Game4Intro Game4Neutral1
## 1              5              5              2         ok             1
## 2              7              4              5         ok             3
## 3              6              6              6         ok             4
## 4              1              5              5         ok             4
## 5              2              4              3         ok             3
## 6              6              5              6         ok             1
##   Game4Neutral2 Game4Neutral3 MusicSelectionEnd MusicSelectionInstrx
## 1             5             2                ok                   ok
## 2             2             4                ok                   ok
## 3             5             2                ok                   ok
## 4             2             5                ok                   ok
## 5             5             5                ok                   ok
## 6             1             1                ok                   ok
##   RecallSelectionEnd RecallSelectionInstrx Subject2 Cond2
## 1                 ok                    ok        1     2
## 2                 ok                    ok        3     1
## 3                 ok                    ok        4     4
## 4                 ok                    ok        5     5
## 5                 ok                    ok        6     6
## 6                 ok                    ok        7     3
##                                                    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  57041             2               4               4
## 3 13642905600  37630             3               5               3
## 4 13642905600  51434             2               5               4
## 5 13642905600  62320             3               3               3
## 6 13642905600  62209             3               5               5
##   HowActiveAngry3 HowActiveExciting1 HowActiveExciting2 HowActiveExciting3
## 1               4                  5                  4                  5
## 2               4                  2                  1                  3
## 3               3                  5                  5                  5
## 4               5                  3                  3                  3
## 5               2                  3                  3                  4
## 6               3                  4                  4                  2
##   HowActiveNeutral1 HowActiveNeutral2 HowActiveNeutral3 HowAngryAngry1
## 1                 2                 2                 2              5
## 2                 1                 2                 1              4
## 3                 2                 2                 1              3
## 4                 2                 1                 1              2
## 5                 1                 2                 1              2
## 6                 1                 1                 3              4
##   HowAngryAngry2 HowAngryAngry3 HowAngryExciting1 HowAngryExciting2
## 1              4              4                 3                 4
## 2              4              4                 3                 1
## 3              2              3                 1                 1
## 4              2              3                 2                 2
## 5              2              2                 2                 1
## 6              4              4                 2                 1
##   HowAngryExciting3 HowAngryNeutral1 HowAngryNeutral2 HowAngryNeutral3
## 1                 3                2                2                1
## 2                 3                1                1                2
## 3                 1                2                1                1
## 4                 1                1                1                1
## 5                 1                1                1                1
## 6                 2                1                1                1
##   HowExcitedAngry1 HowExcitedAngry2 HowExcitedAngry3 HowExcitedExciting1
## 1                4                3                3                   4
## 2                3                3                2                   2
## 3                4                1                3                   4
## 4                4                4                5                   3
## 5                5                2                3                   3
## 6                5                2                3                   3
##   HowExcitedExciting2 HowExcitedExciting3 HowExcitedNeutral1 HowExcitedNeutral2
## 1                   4                   4                  2                  2
## 2                   2                   3                  2                  1
## 3                   3                   5                  2                  2
## 4                   3                   3                  2                  1
## 5                   2                   4                  1                  1
## 6                   4                   4                  1                  1
##   HowExcitedNeutral3 HowPleasantAngry1 HowPleasantAngry2 HowPleasantAngry3
## 1                  2                 1                 2                 1
## 2                  2                 2                 2                 4
## 3                  1                 1                 1                 3
## 4                  3                 4                 3                 2
## 5                  2                 2                 2                 3
## 6                  1                 1                 2                 2
##   HowPleasantExciting1 HowPleasantExciting2 HowPleasantExciting3
## 1                    2                    2                    1
## 2                    2                    2                    2
## 3                    4                    4                    3
## 4                    1                    1                    2
## 5                    3                    3                    4
## 6                    3                    3                    4
##   HowPleasantNeutral1 HowPleasantNeutral2 HowPleasantNeutral3 MusicRatingEnd
## 1                   5                   4                   5             ok
## 2                   2                   2                   1             ok
## 3                   2                   4                   5             ok
## 4                   1                   1                   5             ok
## 5                   3                   3                   4             ok
## 6                   4                   4                   2             ok
##   MusicRatingInstrx WhichGames aboutyou age distractions endinstructions
## 1                ok         ok       ok  18           ok              ok
## 2                ok         ok       ok  18           ok              ok
## 3                ok         ok       ok  18           ok              ok
## 4                ok         ok       ok  18           ok              ok
## 5                ok         ok       ok  19           ok              ok
## 6                ok         ok       ok  18           ok              ok
##   ethnicity overlooking race sex whatabout year Subject3 DDNoMusicLevel
## 1         2          ok    2   1        ok    1        1              3
## 2         2          ok    2   1        ok    1        3              2
## 3         2          ok    2   1        ok    1        4              3
## 4         2          ok    2   1        ok    1        5              3
## 5         2          ok    2   1        ok    1        6              3
## 6         2          ok    1   1        ok    1        7              3
##   DDNoMusicScore DDMusicLevel DDMusicScore SOFNoMusicEnemies
## 1              0            3          830                22
## 2           1250            3          370                15
## 3           1742            3         1921                 3
## 4             60            3         1750                18
## 5            840            3         1380                23
## 6             20            3          170                 7
##   SOFNoMusicFriendlies SOFNoMusicTime SOFMusicEnemies SOFMusicFriendlies
## 1                    2          24360              19                  0
## 2                    0          15300              23                  1
## 3                    0           5280              19                  0
## 4                    2          19140              23                  3
## 5                    1          23220              24                  0
## 6                    1           7740              20                  2
##   SOFMusicTime                           GameComments
## 1        23340                                       
## 2        24300                                       
## 3        16860 Participant died, restart             
## 4        20820 Error in game towards the end of time 
## 5        23400                                       
## 6        23280 Participant died, restart             
##   DoNotUseVideoGamePerformanceData ConfrontationalAngryMusicScore
## 1                               NA                       5.500000
## 2                               NA                       5.333333
## 3                                1                       3.333333
## 4                                1                       6.000000
## 5                               NA                       5.500000
## 6                                1                       5.333333
##   ConfrontationalExcitingMusicScore ConfrontationalNeutralMusicScore
## 1                          3.333333                         2.500000
## 2                          3.000000                         2.333333
## 3                          3.500000                         1.666667
## 4                          1.833333                         3.666667
## 5                          2.666667                         2.833333
## 6                          1.500000                         1.000000
##   ConfrontationalAngryRecallScore ConfrontationalExcitingRecallScore
## 1                            3.75                               1.25
## 2                            2.25                               2.25
## 3                            6.00                               3.50
## 4                            6.00                               4.75
## 5                            3.75                               5.00
## 6                            2.75                               1.00
##   ConfrontationalNeutralRecallScore NonconfrontationalAngryMusicScore
## 1                              2.00                          2.166667
## 2                              2.25                          2.666667
## 3                              1.50                          2.166667
## 4                              1.75                          4.000000
## 5                              4.00                          2.833333
## 6                              3.50                          1.666667
##   NonconfrontationalExcitingMusicScore NonconfrontationalNeutralMusicScore
## 1                             3.166667                            4.000000
## 2                             4.500000                            2.833333
## 3                             4.166667                            3.500000
## 4                             3.000000                            3.666667
## 5                             2.333333                            4.333333
## 6                             3.833333                            3.666667
##   NonconfrontationalAngryRecallScore NonconfrontationalExcitingRecallScore
## 1                               2.50                                  5.25
## 2                               4.25                                  4.25
## 3                               3.75                                  5.00
## 4                               2.00                                  5.75
## 5                               1.25                                  3.50
## 6                               1.00                                  6.25
##   NonconfrontationalNeutralRecallScore ConfrontationalAngerScore
## 1                                 6.25                       4.8
## 2                                 3.25                       4.1
## 3                                 2.00                       4.4
## 4                                 5.00                       6.0
## 5                                 3.75                       4.8
## 6                                 5.50                       4.3
##   ConfrontationalExcitingScore ConfrontationalNeutralScore
## 1                          2.5                         2.3
## 2                          2.7                         2.3
## 3                          3.5                         1.6
## 4                          3.0                         2.9
## 5                          3.6                         3.3
## 6                          1.3                         2.0
##   NonconfrontationalAngerScore NonconfrontationalExcitingScore
## 1                          2.3                             4.0
## 2                          3.3                             4.4
## 3                          2.8                             4.5
## 4                          3.2                             4.1
## 5                          2.2                             2.8
## 6                          1.4                             4.8
##   NonconfrontationalNeutralScore Usable DoNotUse
## 1                            4.9      1       NA
## 2                            3.0      1       NA
## 3                            2.9      1       NA
## 4                            4.2      1       NA
## 5                            4.1      1       NA
## 6                            4.4      1       NA
##                                                                                                                                                                                             ProblemDetails
## 1                                                                                                                                                                                                         
## 2                                                                                                                                                                                                         
## 3                                                                                                                                                                                                         
## 4                                                                                                                                                                                                         
## 5                                                                                                                                                                                                         
## 6                                                                                                                                                                                                         
##   DinerDashWithMusicScore DinerDashWithoutMusicScore MusicCondition
## 1                    5830                       5000       Exciting
## 2                    5370                       1250          Anger
## 3                    6921                       6742          Anger
## 4                    6750                       5060       Exciting
## 5                    6380                       5840        Neutral
## 6                    5170                       5020        Neutral
##   ZDinerDashWithMusicScore ZDinerDashWithoutMusicScore ZSOFNoMusicEnemies
## 1              -0.07333283                   0.2692740          0.7501199
## 2              -0.73344247                  -2.8616517         -0.1401958
## 3               1.49227504                   1.7236934         -1.6664514
## 4               1.24688645                   0.3193688          0.2413681
## 5               0.71592870                   0.9706014          0.8773079
## 6              -1.02044667                   0.2859723         -1.1576995
##   ZSOFMusicEnemies DinerDashDifferenceScore SOFDifferenceScore
## 1      -0.20203285               -0.3426068        -0.95215278
## 2       0.31835480                2.1282092         0.45855062
## 3      -0.20203285               -0.2314183         1.46441854
## 4       0.31835480                0.9275176         0.07698673
## 5       0.44845171               -0.2546727        -0.42885618
## 6      -0.07193594               -1.3064189         1.08576360
##   PleasantScoreForAngryMusic PleasantScoreForExcitingMusic
## 1                   1.333333                      1.666667
## 2                   2.666667                      2.000000
## 3                   1.666667                      3.666667
## 4                   3.000000                      1.333333
## 5                   2.333333                      3.333333
## 6                   1.666667                      3.333333
##   PleasantScoreForNeutralMusic AngryScoreForAngryMusic
## 1                     4.666667                4.333333
## 2                     1.666667                4.000000
## 3                     3.666667                2.666667
## 4                     2.333333                2.333333
## 5                     3.333333                2.000000
## 6                     3.333333                4.000000
##   AngryScoreForExcitingMusic AngryScoreForNeutralMusic
## 1                   3.333333                  1.666667
## 2                   2.333333                  1.333333
## 3                   1.000000                  1.333333
## 4                   1.666667                  1.000000
## 5                   1.333333                  1.000000
## 6                   1.666667                  1.000000
##   ExcitedScoreForExcitingMusic ExcitedScoreForNeutralMusic
## 1                     4.000000                    2.000000
## 2                     2.333333                    1.666667
## 3                     4.000000                    1.666667
## 4                     3.000000                    2.000000
## 5                     3.000000                    1.333333
## 6                     3.666667                    1.000000
##   ActiveScoreForExcitingMusic ActiveScoreForNeutralMusic
## 1                    4.666667                   2.000000
## 2                    2.000000                   1.333333
## 3                    5.000000                   1.666667
## 4                    3.000000                   1.333333
## 5                    3.333333                   1.333333
## 6                    3.333333                   1.666667
##   ExcitedScoreForAngryMusic ActiveScoreForAngryMusic
## 1                  3.333333                 4.000000
## 2                  2.666667                 4.000000
## 3                  2.666667                 3.666667
## 4                  4.333333                 4.666667
## 5                  3.333333                 2.666667
## 6                  3.333333                 4.333333
tail(filtered_d)
##    Subject Cond                                                    Exper
## 83      85    5 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 84      86    3 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 85      87    1 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 86      88    6 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 87      89    2 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
## 88      90    3 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part1.exp
##        Inifile        Date  Time Game1Angry1 Game1Angry2 Game1Angry3
## 83 default.mlp 13644374400 61618           2           5           4
## 84 default.mlp 13644633600 33161           4           3           6
## 85 default.mlp 13644633600 40065           1           3           4
## 86 default.mlp 13644633600 51237           7           7           5
## 87 default.mlp 13644633600 54293           7           6           6
## 88 default.mlp 13644633600 58190           5           5           5
##    Game1AngryFriends Game1AngryStrangers Game1CalmFriends Game1CalmStrangers
## 83                 1                   1                1                  1
## 84                 2                   3                2                  2
## 85                 6                   7                1                  1
## 86                 4                   1                4                  4
## 87                 7                   5                3                  2
## 88                 7                   7                1                  1
##    Game1ExcitedFriends Game1ExcitedStrangers Game1Exciting1 Game1Exciting2
## 83                   1                     1              1              1
## 84                   5                     5              3              4
## 85                   1                     1              1              1
## 86                   7                     4              7              7
## 87                   7                     6              3              5
## 88                   4                     1              1              1
##    Game1Exciting3 Game1Intro Game1Neutral1 Game1Neutral2 Game1Neutral3
## 83              3         ok             2             1             2
## 84              2         ok             3             3             2
## 85              1         ok             2             2             3
## 86              6         ok             2             1             1
## 87              2         ok             1             2             1
## 88              1         ok             1             1             6
##    Game2Angry1 Game2Angry2 Game2Angry3 Game2AngryFriends Game2AngryStrangers
## 83           1           1           3                 1                   1
## 84           4           4           6                 2                   5
## 85           5           5           7                 1                   7
## 86           7           7           4                 1                   1
## 87           6           4           6                 7                   2
## 88           5           1           7                 7                   7
##    Game2CalmFriends Game2CalmStrangers Game2ExcitedFriends
## 83                1                  1                   1
## 84                1                  1                   5
## 85                4                  4                   2
## 86                5                  6                   7
## 87                3                  1                   7
## 88                1                  1                   1
##    Game2ExcitedStrangers Game2Exciting1 Game2Exciting2 Game2Exciting3
## 83                     1              1              1              1
## 84                     5              1              2              3
## 85                     2              5              1              1
## 86                     4              7              1              1
## 87                     5              1              3              1
## 88                     4              3              2              2
##    Game2Intro Game2Neutral1 Game2Neutral2 Game2Neutral3 Game3Angry1 Game3Angry2
## 83         ok             1             1             1           3           4
## 84         ok             2             2             1           3           3
## 85         ok             1             1             1           5           3
## 86         ok             1             1             1           2           1
## 87         ok             1             2             2           2           4
## 88         ok             1             3             1           1           1
##    Game3Angry3 Game3AngryFriends Game3AngryStrangers Game3CalmFriends
## 83           5                 2                   2                2
## 84           6                 2                   2                4
## 85           6                 1                   2                5
## 86           7                 1                   1                7
## 87           4                 1                   1                6
## 88           5                 2                   2                7
##    Game3CalmStrangers Game3ExcitedFriends Game3ExcitedStrangers Game3Exciting1
## 83                  3                   4                     2              1
## 84                  4                   5                     5              2
## 85                  6                   4                     2              1
## 86                  2                   7                     3              2
## 87                  4                   3                     6              5
## 88                  6                   7                     7              2
##    Game3Exciting2 Game3Exciting3 Game3Intro Game3Neutral1 Game3Neutral2
## 83              2              3         ok             1             1
## 84              4              2         ok             3             1
## 85              1              1         ok             5             1
## 86              1              1         ok             4             6
## 87              5              6         ok             4             1
## 88              1              1         ok             4             4
##    Game3Neutral3 Game4Angry1 Game4Angry2 Game4Angry3 Game4AngryFriends
## 83             2           1           3           3                 2
## 84             1           3           3           2                 2
## 85             2           3           1           4                 1
## 86             2           2           1           7                 3
## 87             6           1           1           1                 1
## 88             7           1           3           1                 3
##    Game4AngryStrangers Game4CalmFriends Game4CalmStrangers Game4ExcitedFriends
## 83                   2                3                  2                   4
## 84                   3                5                  3                   5
## 85                   1                7                  7                   7
## 86                   4                2                  6                   7
## 87                   1                7                  5                   7
## 88                   3                5                  4                   7
##    Game4ExcitedStrangers Game4Exciting1 Game4Exciting2 Game4Exciting3
## 83                     4              1              4              1
## 84                     4              3              5              5
## 85                     7              2              5              5
## 86                     7              4              1              2
## 87                     5              5              4              7
## 88                     7              2              4              5
##    Game4Intro Game4Neutral1 Game4Neutral2 Game4Neutral3 MusicSelectionEnd
## 83         ok             1             1             4                ok
## 84         ok             3             4             1                ok
## 85         ok             5             5             4                ok
## 86         ok             5             3             1                ok
## 87         ok             5             5             3                ok
## 88         ok             1             2             5                ok
##    MusicSelectionInstrx RecallSelectionEnd RecallSelectionInstrx Subject2 Cond2
## 83                   ok                 ok                    ok       85     5
## 84                   ok                 ok                    ok       86     3
## 85                   ok                 ok                    ok       87     1
## 86                   ok                 ok                    ok       88     6
## 87                   ok                 ok                    ok       89     2
## 88                   ok                 ok                    ok       90     3
##                                                     Exper_A   Inifile_A
## 83 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 84 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 85 C:\\Users\\msplab\\Desktop\\Study 151\\Study151Part2.exp default.mlp
## 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
##         Date_A Time_A DescribeMusic HowActiveAngry1 HowActiveAngry2
## 83 13644374400  63914             2               4               3
## 84 13644633600  35448             3               4               5
## 85 13644633600  42314             2               5               5
## 86 13644633600  53402             2               5               5
## 87 13644633600  56552             2               5               3
## 88 13644633600  60558             2               5               5
##    HowActiveAngry3 HowActiveExciting1 HowActiveExciting2 HowActiveExciting3
## 83               3                  2                  4                  4
## 84               4                  4                  4                  4
## 85               4                  5                  5                  5
## 86               5                  5                  5                  5
## 87               4                  4                  5                  5
## 88               3                  5                  5                  5
##    HowActiveNeutral1 HowActiveNeutral2 HowActiveNeutral3 HowAngryAngry1
## 83                 3                 2                 1              2
## 84                 1                 2                 1              4
## 85                 1                 1                 1              3
## 86                 2                 2                 1              5
## 87                 1                 2                 1              5
## 88                 1                 1                 1              5
##    HowAngryAngry2 HowAngryAngry3 HowAngryExciting1 HowAngryExciting2
## 83              3              3                 2                 2
## 84              5              4                 3                 2
## 85              5              1                 1                 1
## 86              5              1                 3                 1
## 87              5              4                 2                 3
## 88              5              3                 3                 1
##    HowAngryExciting3 HowAngryNeutral1 HowAngryNeutral2 HowAngryNeutral3
## 83                 2                2                2                2
## 84                 1                1                1                1
## 85                 1                1                5                1
## 86                 2                1                1                1
## 87                 1                1                1                1
## 88                 1                1                1                1
##    HowExcitedAngry1 HowExcitedAngry2 HowExcitedAngry3 HowExcitedExciting1
## 83                2                4                3                   1
## 84                5                5                5                   4
## 85                4                4                4                   3
## 86                5                5                5                   5
## 87                5                5                4                   3
## 88                5                5                5                   4
##    HowExcitedExciting2 HowExcitedExciting3 HowExcitedNeutral1
## 83                   3                   3                  2
## 84                   4                   4                  1
## 85                   4                   4                  1
## 86                   5                   5                  1
## 87                   4                   5                  2
## 88                   5                   4                  1
##    HowExcitedNeutral2 HowExcitedNeutral3 HowPleasantAngry1 HowPleasantAngry2
## 83                  2                  2                 2                 2
## 84                  1                  1                 2                 2
## 85                  2                  1                 3                 3
## 86                  5                  5                 1                 1
## 87                  2                  1                 3                 3
## 88                  1                  2                 2                 1
##    HowPleasantAngry3 HowPleasantExciting1 HowPleasantExciting2
## 83                 3                    1                    1
## 84                 2                    1                    2
## 85                 4                    2                    4
## 86                 5                    5                    5
## 87                 2                    3                    3
## 88                 3                    1                    5
##    HowPleasantExciting3 HowPleasantNeutral1 HowPleasantNeutral2
## 83                    1                   3                   4
## 84                    3                   4                   5
## 85                    3                   3                   3
## 86                    2                   5                   5
## 87                    5                   4                   4
## 88                    2                   4                   4
##    HowPleasantNeutral3 MusicRatingEnd MusicRatingInstrx WhichGames aboutyou age
## 83                   4             ok                ok         ok       ok  19
## 84                   4             ok                ok         ok       ok  19
## 85                   2             ok                ok         ok       ok  20
## 86                   5             ok                ok         ok       ok  18
## 87                   5             ok                ok         ok       ok  18
## 88                   5             ok                ok         ok       ok  18
##    distractions endinstructions ethnicity overlooking race sex whatabout year
## 83           ok              ok         2          ok    2   1        ok    1
## 84           ok              ok         2          ok    2   1        ok    1
## 85           ok              ok         2          ok    2   1        ok    2
## 86           ok              ok         2          ok    1   1        ok    1
## 87           ok              ok         2          ok    2   1        ok    1
## 88           ok              ok         2          ok    2   1        ok    1
##    Subject3 DDNoMusicLevel DDNoMusicScore DDMusicLevel DDMusicScore
## 83       85              3           1000            3         1150
## 84       86              3              0            3          940
## 85       87              3              0            3          170
## 86       88              3              0            3          866
## 87       89              2           3280            3          820
## 88       90              2           3040            3            0
##    SOFNoMusicEnemies SOFNoMusicFriendlies SOFNoMusicTime SOFMusicEnemies
## 83                25                    2          24420              30
## 84                19                    2          24480              18
## 85                15                    0          13140              25
## 86                24                    0          23460              27
## 87                 7                    0           8880              31
## 88                22                    2          28440              26
##    SOFMusicFriendlies SOFMusicTime                           GameComments
## 83                  0        23460                                       
## 84                  1        23640                                       
## 85                  1        23160 Participant died, restart             
## 86                  0        22380                                       
## 87                  0        23100                                       
## 88                  0        25500                                       
##    DoNotUseVideoGamePerformanceData ConfrontationalAngryMusicScore
## 83                               NA                       2.666667
## 84                               NA                       4.500000
## 85                                1                       4.166667
## 86                               NA                       6.166667
## 87                                1                       5.833333
## 88                               NA                       4.666667
##    ConfrontationalExcitingMusicScore ConfrontationalNeutralMusicScore
## 83                          1.333333                         1.333333
## 84                          2.500000                         2.166667
## 85                          1.666667                         1.666667
## 86                          4.833333                         1.166667
## 87                          2.500000                         1.500000
## 88                          1.666667                         2.166667
##    ConfrontationalAngryRecallScore ConfrontationalExcitingRecallScore
## 83                            1.00                               1.00
## 84                            3.00                               5.00
## 85                            6.50                               1.25
## 86                            2.50                               5.50
## 87                            5.25                               6.25
## 88                            7.00                               3.25
##    ConfrontationalNeutralRecallScore NonconfrontationalAngryMusicScore
## 83                              1.00                          3.166667
## 84                              1.75                          3.333333
## 85                              1.75                          3.666667
## 86                              4.50                          3.333333
## 87                              2.25                          2.166667
## 88                              1.00                          2.000000
##    NonconfrontationalExcitingMusicScore NonconfrontationalNeutralMusicScore
## 83                             2.000000                            1.666667
## 84                             3.500000                            2.166667
## 85                             2.500000                            3.666667
## 86                             1.833333                            3.500000
## 87                             5.333333                            4.000000
## 88                             2.500000                            3.833333
##    NonconfrontationalAngryRecallScore NonconfrontationalExcitingRecallScore
## 83                               2.00                                  3.50
## 84                               2.25                                  4.75
## 85                               1.25                                  4.25
## 86                               1.75                                  6.00
## 87                               1.00                                  4.25
## 88                               2.25                                  7.00
##    NonconfrontationalNeutralRecallScore ConfrontationalAngerScore
## 83                                 2.25                       2.0
## 84                                 3.75                       3.9
## 85                                 5.75                       5.1
## 86                                 5.50                       4.7
## 87                                 5.25                       5.6
## 88                                 6.00                       5.6
##    ConfrontationalExcitingScore ConfrontationalNeutralScore
## 83                          1.2                         1.2
## 84                          3.5                         2.0
## 85                          1.5                         1.7
## 86                          5.1                         2.5
## 87                          4.0                         1.8
## 88                          2.3                         1.7
##    NonconfrontationalAngerScore NonconfrontationalExcitingScore
## 83                          2.7                             2.6
## 84                          2.9                             4.0
## 85                          2.7                             3.2
## 86                          2.7                             3.5
## 87                          1.7                             4.9
## 88                          2.1                             4.3
##    NonconfrontationalNeutralScore Usable DoNotUse
## 83                            1.9      1       NA
## 84                            2.8      1       NA
## 85                            4.5      1       NA
## 86                            4.3      1       NA
## 87                            4.5      1       NA
## 88                            4.7      1       NA
##                                                                                                                                                                                              ProblemDetails
## 83                                                                                                                                                                                                         
## 84                                                                                                                                                                                                         
## 85                                                                                                                                                                                                         
## 86                                                                                                                                                                                                         
## 87                                                                                                                                                                                                         
## 88                                                                                                                                                                                                         
##    DinerDashWithMusicScore DinerDashWithoutMusicScore MusicCondition
## 83                    6150                       6000       Exciting
## 84                    5940                       5000        Neutral
## 85                    5170                       5000          Anger
## 86                    5866                       5000        Neutral
## 87                    5820                       3280       Exciting
## 88                    5000                       3040        Neutral
##    ZDinerDashWithMusicScore ZDinerDashWithoutMusicScore ZSOFNoMusicEnemies
## 83               0.38587388                    1.104188          1.1316838
## 84               0.08451947                    0.269274          0.3685560
## 85              -1.02044667                    0.269274         -0.1401958
## 86              -0.02167208                    0.269274          1.0044959
## 87              -0.08768304                   -1.166777         -1.1576995
## 88              -1.26440023                   -1.367157          0.7501199
##    ZSOFMusicEnemies DinerDashDifferenceScore SOFDifferenceScore
## 83        1.2290332               -0.7183137         0.09734937
## 84       -0.3321298               -0.1847545        -0.70068580
## 85        0.5785486               -1.2897207         0.71874445
## 86        0.8387424               -0.2909461        -0.16575340
## 87        1.3591301                1.0790942         2.51682964
## 88        0.7086455                0.1027563        -0.04147439
##    PleasantScoreForAngryMusic PleasantScoreForExcitingMusic
## 83                   2.333333                      1.000000
## 84                   2.000000                      2.000000
## 85                   3.333333                      3.000000
## 86                   2.333333                      4.000000
## 87                   2.666667                      3.666667
## 88                   2.000000                      2.666667
##    PleasantScoreForNeutralMusic AngryScoreForAngryMusic
## 83                     3.666667                2.666667
## 84                     4.333333                4.333333
## 85                     2.666667                3.000000
## 86                     5.000000                3.666667
## 87                     4.333333                4.666667
## 88                     4.333333                4.333333
##    AngryScoreForExcitingMusic AngryScoreForNeutralMusic
## 83                   2.000000                  2.000000
## 84                   2.000000                  1.000000
## 85                   1.000000                  2.333333
## 86                   2.000000                  1.000000
## 87                   2.000000                  1.000000
## 88                   1.666667                  1.000000
##    ExcitedScoreForExcitingMusic ExcitedScoreForNeutralMusic
## 83                     2.333333                    2.000000
## 84                     4.000000                    1.000000
## 85                     3.666667                    1.333333
## 86                     5.000000                    3.666667
## 87                     4.000000                    1.666667
## 88                     4.333333                    1.333333
##    ActiveScoreForExcitingMusic ActiveScoreForNeutralMusic
## 83                    3.333333                   2.000000
## 84                    4.000000                   1.333333
## 85                    5.000000                   1.000000
## 86                    5.000000                   1.666667
## 87                    4.666667                   1.333333
## 88                    5.000000                   1.000000
##    ExcitedScoreForAngryMusic ActiveScoreForAngryMusic
## 83                  3.000000                 3.333333
## 84                  5.000000                 4.333333
## 85                  4.000000                 4.666667
## 86                  5.000000                 5.000000
## 87                  4.666667                 4.000000
## 88                  5.000000                 4.333333

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.

get rid of unnecessary columns

The dataset contains a bunch of columns we don’t care about:

  • The dataset contains three subject columns, which are identical except for a single NA which is not mentioned in the protocol, and so is likely an error.
  • Columns telling us the path to the executable run for each part of the experiment, we don’t really care about that.
  • Etc.

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
filtered_d
##    Subject Cond Game1Angry1 Game1Angry2 Game1Angry3 Game1AngryFriends
## 1        1    2           6           6           5                 2
## 2        3    1           6           5           7                 2
## 3        4    4           4           1           1                 6
## 4        5    5           6           6           7                 6
## 5        6    6           5           5           6                 3
## 6        7    3           6           6           6                 2
## 7        8    6           5           4           5                 3
## 8        9    5           4           1           4                 7
## 9       10    1           7           5           7                 6
## 10      11    2           3           4           3                 3
## 11      12    4           5           6           1                 7
## 12      13    4           4           6           5                 3
## 13      14    6           2           5           4                 5
## 14      15    2           6           1           6                 2
## 15      16    3           4           5           5                 4
## 16      17    5           3           5           7                 6
## 17      18    1           7           7           5                 5
## 18      19    4           7           4           5                 2
## 19      20    3           5           3           7                 6
## 20      21    6           4           1           4                 1
## 21      22    5           4           2           2                 7
## 22      24    2           5           5           4                 3
## 23      25    2           4           7           6                 4
## 24      26    1           6           2           6                 1
## 25      27    3           4           4           7                 5
## 26      28    4           7           6           6                 2
## 27      29    6           6           6           7                 6
## 28      30    5           1           3           6                 5
## 29      31    4           3           6           1                 5
## 30      32    5           5           3           6                 1
## 31      33    3           7           7           4                 5
## 32      34    1           4           5           5                 3
## 33      35    2           2           2           3                 5
## 34      36    6           6           5           5                 6
## 35      37    1           4           4           7                 1
## 36      38    6           1           5           4                 1
## 37      39    4           3           5           6                 6
## 38      40    3           5           5           5                 6
## 39      41    5           6           4           6                 3
## 40      42    2           6           6           7                 5
## 41      43    6           5           6           7                 5
## 42      44    2           5           6           5                 3
## 43      45    3           5           5           6                 5
## 44      46    1           1           1           6                 2
## 45      47    4           4           2           5                 4
## 46      48    5           3           3           6                 5
## 47      49    5           5           6           5                 4
## 48      50    3           6           6           7                 5
## 49      51    4           7           4           7                 5
## 50      52    1           5           3           4                 2
## 51      53    6           7           6           6                 2
## 52      54    2           3           6           7                 6
## 53      55    4           7           6           6                 7
## 54      56    3           3           1           5                 1
## 55      57    2           3           3           4                 1
## 56      58    5           5           1           7                 2
## 57      59    1           7           7           7                 5
## 58      60    6           6           7           5                 6
## 59      61    3           7           7           7                 2
## 60      62    6           6           2           6                 4
## 61      63    1           6           7           5                 3
## 62      64    2           6           6           7                 3
## 63      65    4           7           3           5                 1
## 64      66    5           7           4           7                 1
## 65      67    4           1           1           1                 1
## 66      68    3           6           7           6                 4
## 67      69    6           7           7           7                 6
## 68      70    2           5           5           7                 6
## 69      71    5           6           6           1                 6
## 70      72    1           1           7           5                 2
## 71      73    1           3           1           4                 2
## 72      74    2           4           5           7                 2
## 73      75    6           6           5           2                 6
## 74      76    5           6           5           5                 7
## 75      77    4           6           5           5                 2
## 76      78    3           7           7           7                 5
## 77      79    6           3           4           6                 3
## 78      80    2           5           1           3                 1
## 79      81    5           5           5           7                 6
## 80      82    3           6           6           5                 5
## 81      83    4           7           6           4                 1
## 82      84    4           7           7           7                 4
## 83      85    5           2           5           4                 1
## 84      86    3           4           3           6                 2
## 85      87    1           1           3           4                 6
## 86      88    6           7           7           5                 4
## 87      89    2           7           6           6                 7
## 88      90    3           5           5           5                 7
##    Game1AngryStrangers Game1CalmFriends Game1CalmStrangers Game1ExcitedFriends
## 1                    5                2                  2                   1
## 2                    2                2                  2                   2
## 3                    6                2                  1                   3
## 4                    6                2                  2                   5
## 5                    4                5                  4                   6
## 6                    6                6                  1                   1
## 7                    6                1                  3                   2
## 8                    7                4                  5                   3
## 9                    6                2                  2                   5
## 10                   5                1                  2                   2
## 11                   7                3                  3                   4
## 12                   6                2                  2                   3
## 13                   6                2                  1                   3
## 14                   6                2                  6                   6
## 15                   7                2                  1                   1
## 16                   6                2                  2                   3
## 17                   6                2                  3                   3
## 18                   6                1                  2                   2
## 19                   7                2                  2                   4
## 20                   1                1                  1                   2
## 21                   7                2                  2                   2
## 22                   5                1                  1                   1
## 23                   5                2                  2                   5
## 24                   1                7                  7                   5
## 25                   5                3                  2                   5
## 26                   2                2                  1                   6
## 27                   7                2                  1                   4
## 28                   5                2                  3                   4
## 29                   6                3                  3                   4
## 30                   3                2                  2                   2
## 31                   7                2                  2                   3
## 32                   6                3                  6                   3
## 33                   6                4                  4                   2
## 34                   5                2                  2                   4
## 35                   7                4                  5                   2
## 36                   1                6                  5                   4
## 37                   7                2                  2                   2
## 38                   6                3                  3                   3
## 39                   7                1                  2                   4
## 40                   7                2                  2                   6
## 41                   7                1                  1                   2
## 42                   4                5                  3                   5
## 43                   5                3                  3                   4
## 44                   4                3                  1                   5
## 45                   4                4                  4                   4
## 46                   7                4                  3                   2
## 47                   5                4                  4                   5
## 48                   7                2                  1                   1
## 49                   7                2                  1                   3
## 50                   3                5                  4                   5
## 51                   4                4                  3                   6
## 52                   6                3                  3                   4
## 53                   7                1                  1                   5
## 54                   1                3                  3                   3
## 55                   4                1                  1                   1
## 56                   1                4                  4                   3
## 57                   7                2                  2                   4
## 58                   7                1                  2                   5
## 59                   6                1                  2                   2
## 60                   7                2                  4                   1
## 61                   7                2                  2                   2
## 62                   6                4                  6                   5
## 63                   1                4                  4                   6
## 64                   1                3                  3                   5
## 65                   1                3                  3                   4
## 66                   7                1                  4                   3
## 67                   4                3                  2                   5
## 68                   6                1                  1                   1
## 69                   4                3                  1                   5
## 70                   6                1                  1                   3
## 71                   7                2                  2                   2
## 72                   7                4                  2                   7
## 73                   7                2                  2                   4
## 74                   7                1                  5                   1
## 75                   5                2                  2                   4
## 76                   7                2                  4                   5
## 77                   3                2                  4                   6
## 78                   4                1                  1                   1
## 79                   5                4                  5                   5
## 80                   6                3                  1                   5
## 81                   6                2                  1                   7
## 82                   7                1                  1                   1
## 83                   1                1                  1                   1
## 84                   3                2                  2                   5
## 85                   7                1                  1                   1
## 86                   1                4                  4                   7
## 87                   5                3                  2                   7
## 88                   7                1                  1                   4
##    Game1ExcitedStrangers Game1Exciting1 Game1Exciting2 Game1Exciting3
## 1                      2              3              2              6
## 2                      2              2              3              4
## 3                      4              5              4              5
## 4                      5              1              3              2
## 5                      4              3              2              4
## 6                      1              1              4              1
## 7                      2              4              3              4
## 8                      2              3              4              2
## 9                      5              6              3              4
## 10                     3              1              5              1
## 11                     5              4              4              5
## 12                     3              2              5              2
## 13                     4              2              2              2
## 14                     2              2              6              2
## 15                     3              3              1              3
## 16                     1              1              1              1
## 17                     3              5              5              3
## 18                     6              3              2              6
## 19                     4              2              1              2
## 20                     2              5              5              4
## 21                     4              2              1              2
## 22                     2              4              1              4
## 23                     6              2              4              6
## 24                     5              7              4              7
## 25                     1              3              2              2
## 26                     3              1              1              1
## 27                     2              3              2              2
## 28                     2              1              6              2
## 29                     4              6              5              2
## 30                     2              1              2              1
## 31                     4              2              1              2
## 32                     5              6              6              4
## 33                     1              1              5              1
## 34                     4              3              2              2
## 35                     6              1              1              1
## 36                     4              1              4              2
## 37                     2              2              1              1
## 38                     3              6              4              4
## 39                     6              1              3              3
## 40                     4              4              3              5
## 41                     2              3              2              3
## 42                     5              3              4              3
## 43                     4              5              2              6
## 44                     5              6              5              6
## 45                     4              1              1              1
## 46                     2              4              2              3
## 47                     5              4              3              4
## 48                     2              3              2              7
## 49                     2              6              3              5
## 50                     5              4              2              2
## 51                     5              6              2              7
## 52                     4              1              1              1
## 53                     4              2              4              3
## 54                     1              4              2              4
## 55                     2              2              2              2
## 56                     6              1              1              1
## 57                     4              4              3              2
## 58                     4              3              3              4
## 59                     2              3              2              4
## 60                     2              6              2              3
## 61                     2              1              1              1
## 62                     5              3              3              2
## 63                     5              1              1              4
## 64                     5              3              1              1
## 65                     3              1              4              3
## 66                     5              3              3              4
## 67                     3              5              5              2
## 68                     1              1              1              1
## 69                     6              3              5              1
## 70                     5              1              2              1
## 71                     2              5              5              3
## 72                     4              1              1              1
## 73                     3              1              2              3
## 74                     2              1              2              1
## 75                     4              2              1              1
## 76                     6              4              3              2
## 77                     6              2              2              1
## 78                     1              1              1              1
## 79                     3              1              2              3
## 80                     4              2              1              4
## 81                     7              6              1              1
## 82                     3              3              1              5
## 83                     1              1              1              3
## 84                     5              3              4              2
## 85                     1              1              1              1
## 86                     4              7              7              6
## 87                     6              3              5              2
## 88                     1              1              1              1
##    Game1Neutral1 Game1Neutral2 Game1Neutral3 Game2Angry1 Game2Angry2
## 1              2             4             4           6           4
## 2              1             2             3           5           3
## 3              1             2             2           6           2
## 4              3             2             4           5           6
## 5              2             2             4           6           5
## 6              1             1             1           7           6
## 7              2             2             2           5           5
## 8              2             1             1           1           1
## 9              1             2             1           6           5
## 10             1             1             2           6           5
## 11             1             1             1           7           7
## 12             1             2             5           7           7
## 13             2             1             1           2           5
## 14             5             4             6           6           1
## 15             1             1             2           1           4
## 16             3             2             1           5           3
## 17             2             3             1           7           7
## 18             1             1             1           6           7
## 19             1             1             1           4           4
## 20             1             1             2           4           2
## 21             1             1             1           4           5
## 22             1             1             1           4           4
## 23             1             2             2           1           6
## 24             1             4             3           7           4
## 25             1             2             4           5           7
## 26             1             1             1           5           1
## 27             1             1             1           6           7
## 28             2             2             3           4           1
## 29             2             5             1           5           6
## 30             1             4             3           5           5
## 31             1             1             1           7           6
## 32             5             2             3           6           5
## 33             2             3             5           4           5
## 34             2             2             1           5           4
## 35             3             5             2           5           1
## 36             3             6             3           1           1
## 37             1             1             2           6           7
## 38             1             2             2           5           6
## 39             2             3             4           6           6
## 40             2             3             1           6           6
## 41             1             1             1           3           2
## 42             3             2             2           5           5
## 43             3             4             2           6           5
## 44             1             1             1           5           6
## 45             1             7             7           3           2
## 46             3             2             5           5           5
## 47             3             3             3           7           6
## 48             1             1             3           6           6
## 49             1             2             2           5           3
## 50             2             3             3           5           2
## 51             3             1             1           6           6
## 52             1             1             1           5           6
## 53             2             1             1           6           6
## 54             4             1             2           5           1
## 55             2             2             2           4           4
## 56             1             1             1           6           5
## 57             2             5             3           7           7
## 58             3             2             1           5           5
## 59             4             2             1           6           7
## 60             1             2             4           6           5
## 61             1             1             1           7           7
## 62             2             3             2           5           4
## 63             2             1             1           7           6
## 64             7             7             2           6           3
## 65             3             4             1           4           1
## 66             2             2             2           5           5
## 67             1             3             2           5           7
## 68             1             1             1           5           7
## 69             1             1             1           4           6
## 70             1             2             6           6           7
## 71             3             3             2           4           3
## 72             1             1             1           4           7
## 73             1             1             2           6           6
## 74             1             1             1           5           6
## 75             1             1             1           4           6
## 76             1             2             2           6           2
## 77             3             1             3           1           1
## 78             1             1             1           5           1
## 79             1             3             4           3           4
## 80             1             1             1           4           5
## 81             1             1             1           7           7
## 82             1             1             2           7           7
## 83             2             1             2           1           1
## 84             3             3             2           4           4
## 85             2             2             3           5           5
## 86             2             1             1           7           7
## 87             1             2             1           6           4
## 88             1             1             6           5           1
##    Game2Angry3 Game2AngryFriends Game2AngryStrangers Game2CalmFriends
## 1            6                 3                   6                1
## 2            6                 3                   3                3
## 3            6                 3                   6                1
## 4            6                 5                   6                1
## 5            6                 3                   5                3
## 6            1                 1                   1                1
## 7            4                 2                   5                1
## 8            2                 1                   7                7
## 9            6                 6                   7                1
## 10           4                 5                   6                2
## 11           4                 6                   7                1
## 12           3                 6                   5                1
## 13           5                 2                   6                2
## 14           5                 2                   6                3
## 15           6                 3                   6                1
## 16           6                 5                   7                1
## 17           6                 4                   6                2
## 18           6                 4                   7                2
## 19           7                 6                   7                2
## 20           4                 1                   2                1
## 21           5                 7                   7                2
## 22           3                 2                   5                1
## 23           5                 7                   6                2
## 24           5                 1                   1                7
## 25           6                 6                   5                2
## 26           4                 3                   2                5
## 27           7                 5                   5                1
## 28           6                 2                   6                1
## 29           2                 7                   7                3
## 30           3                 1                   4                3
## 31           5                 6                   7                1
## 32           7                 6                   4                2
## 33           4                 4                   4                2
## 34           4                 4                   5                1
## 35           7                 1                   7                3
## 36           7                 1                   1                6
## 37           5                 6                   7                2
## 38           7                 6                   7                3
## 39           5                 4                   6                2
## 40           6                 5                   7                4
## 41           7                 5                   7                2
## 42           5                 6                   4                5
## 43           4                 6                   5                3
## 44           2                 4                   6                3
## 45           5                 4                   4                4
## 46           4                 7                   7                1
## 47           4                 5                   5                4
## 48           7                 7                   7                1
## 49           4                 6                   5                1
## 50           5                 3                   3                4
## 51           6                 2                   6                4
## 52           3                 5                   6                3
## 53           5                 7                   7                1
## 54           5                 1                   1                3
## 55           3                 2                   3                1
## 56           6                 1                   1                3
## 57           7                 6                   6                2
## 58           4                 5                   5                2
## 59           7                 3                   6                1
## 60           4                 5                   7                2
## 61           4                 2                   6                1
## 62           6                 2                   5                6
## 63           6                 1                   2                4
## 64           7                 7                   1                7
## 65           3                 4                   1                3
## 66           6                 4                   7                1
## 67           7                 7                   5                3
## 68           1                 6                   7                1
## 69           4                 7                   5                3
## 70           5                 2                   2                4
## 71           4                 5                   6                3
## 72           2                 3                   7                4
## 73           5                 5                   5                1
## 74           2                 7                   6                1
## 75           4                 5                   6                2
## 76           6                 6                   7                2
## 77           6                 5                   6                6
## 78           4                 1                   2                1
## 79           7                 4                   6                4
## 80           6                 5                   6                2
## 81           5                 6                   7                1
## 82           7                 1                   6                1
## 83           3                 1                   1                1
## 84           6                 2                   5                1
## 85           7                 1                   7                4
## 86           4                 1                   1                5
## 87           6                 7                   2                3
## 88           7                 7                   7                1
##    Game2CalmStrangers Game2ExcitedFriends Game2ExcitedStrangers Game2Exciting1
## 1                   2                   1                     1              3
## 2                   3                   3                     3              2
## 3                   1                   2                     4              3
## 4                   1                   4                     4              1
## 5                   2                   5                     4              2
## 6                   1                   1                     1              1
## 7                   2                   2                     4              3
## 8                   1                   4                     1              1
## 9                   2                   4                     3              7
## 10                  2                   4                     4              1
## 11                  3                   5                     5              6
## 12                  2                   3                     4              1
## 13                  3                   4                     4              2
## 14                  3                   4                     2              3
## 15                  2                   3                     4              2
## 16                  1                   1                     1              1
## 17                  4                   5                     4              2
## 18                  1                   5                     6              2
## 19                  2                   4                     4              1
## 20                  1                   1                     1              4
## 21                  2                   4                     2              6
## 22                  1                   1                     3              1
## 23                  2                   5                     2              2
## 24                  5                   5                     6              1
## 25                  2                   4                     3              2
## 26                  3                   6                     4              1
## 27                  2                   2                     4              4
## 28                  3                   2                     3              2
## 29                  2                   3                     2              5
## 30                  1                   2                     1              6
## 31                  2                   3                     5              3
## 32                  2                   1                     4              6
## 33                  3                   2                     6              4
## 34                  2                   6                     1              2
## 35                  4                   4                     7              1
## 36                  3                   3                     6              1
## 37                  2                   2                     2              1
## 38                  3                   5                     5              4
## 39                  2                   3                     5              1
## 40                  2                   3                     3              2
## 41                  1                   2                     3              1
## 42                  4                   4                     3              6
## 43                  4                   5                     5              3
## 44                  2                   1                     2              5
## 45                  4                   4                     4              1
## 46                  1                   4                     3              2
## 47                  4                   4                     5              2
## 48                  2                   1                     1              4
## 49                  1                   3                     2              2
## 50                  3                   4                     4              2
## 51                  2                   5                     3              2
## 52                  2                   2                     3              1
## 53                  1                   4                     4              2
## 54                  1                   2                     2              1
## 55                  1                   1                     1              3
## 56                  1                   2                     1              1
## 57                  2                   3                     4              3
## 58                  1                   7                     6              2
## 59                  1                   1                     1              1
## 60                  3                   1                     4              4
## 61                  5                   1                     1              1
## 62                  5                   4                     4              3
## 63                  4                   5                     4              3
## 64                  6                   1                     5              2
## 65                  3                   3                     3              3
## 66                  3                   2                     5              4
## 67                  2                   6                     5              3
## 68                  1                   1                     5              1
## 69                  1                   5                     5              3
## 70                  2                   7                     7              6
## 71                  3                   3                     2              4
## 72                  4                   6                     7              3
## 73                  1                   3                     4              2
## 74                  1                   2                     2              2
## 75                  2                   4                     1              1
## 76                  4                   3                     4              4
## 77                  3                   5                     4              1
## 78                  1                   1                     1              1
## 79                  5                   3                     5              1
## 80                  1                   4                     5              2
## 81                  1                   1                     2              3
## 82                  1                   1                     1              2
## 83                  1                   1                     1              1
## 84                  1                   5                     5              1
## 85                  4                   2                     2              5
## 86                  6                   7                     4              7
## 87                  1                   7                     5              1
## 88                  1                   1                     4              3
##    Game2Exciting2 Game2Exciting3 Game2Neutral1 Game2Neutral2 Game2Neutral3
## 1               2              4             1             3             1
## 2               5              2             4             3             1
## 3               2              2             1             1             3
## 4               2              2             4             4             5
## 5               2              3             2             3             4
## 6               1              1             1             1             1
## 7               3              3             1             1             1
## 8               1              1             1             1             1
## 9               3              5             1             3             1
## 10              1              1             1             1             1
## 11              4              4             1             1             1
## 12              2              1             1             2             3
## 13              1              2             1             1             1
## 14              7              6             3             6             5
## 15              1              2             1             1             4
## 16              2              1             1             1             1
## 17              1              1             1             1             1
## 18              2              1             1             1             1
## 19              1              1             1             1             1
## 20              3              2             1             1             1
## 21              1              1             1             1             1
## 22              2              5             1             1             1
## 23              4              3             1             2             1
## 24              1              1             1             5             3
## 25              3              4             1             3             2
## 26              1              1             1             1             1
## 27              5              2             1             1             1
## 28              3              1             1             3             2
## 29              6              2             2             2             1
## 30              2              1             1             2             1
## 31              2              1             1             1             1
## 32              5              3             1             2             3
## 33              7              1             1             1             1
## 34              2              2             1             2             1
## 35              1              1             3             2             3
## 36              1              2             2             4             1
## 37              1              1             1             1             1
## 38              3              3             4             1             5
## 39              4              4             1             2             5
## 40              1              2             1             2             3
## 41              3              1             1             1             1
## 42              5              4             3             3             3
## 43              3              4             3             4             2
## 44              5              3             2             2             3
## 45              2              1             1             3             6
## 46              2              3             2             1             3
## 47              2              1             4             2             2
## 48              1              1             2             3             3
## 49              1              1             2             1             1
## 50              3              2             2             3             2
## 51              2              3             3             1             1
## 52              1              1             1             2             2
## 53              4              4             1             1             1
## 54              1              2             3             1             2
## 55              2              3             2             2             2
## 56              2              1             1             1             3
## 57              3              2             2             4             1
## 58              2              2             1             1             1
## 59              1              1             3             3             1
## 60              2              1             1             1             1
## 61              1              1             1             1             1
## 62              2              2             2             5             6
## 63              3              2             2             4             2
## 64              1              1             7             7             1
## 65              2              1             6             6             2
## 66              4              3             2             3             2
## 67              3              2             1             2             1
## 68              1              1             1             1             1
## 69              1              3             2             1             1
## 70              2              1             2             2             5
## 71              6              3             2             2             2
## 72              1              4             1             1             1
## 73              2              4             1             2             1
## 74              1              1             1             1             1
## 75              1              5             1             1             1
## 76              5              5             1             1             2
## 77              1              1             1             1             3
## 78              1              1             1             3             1
## 79              4              4             2             3             6
## 80              2              2             1             2             4
## 81              1              1             1             1             1
## 82              1              2             1             1             2
## 83              1              1             1             1             1
## 84              2              3             2             2             1
## 85              1              1             1             1             1
## 86              1              1             1             1             1
## 87              3              1             1             2             2
## 88              2              2             1             3             1
##    Game3Angry1 Game3Angry2 Game3Angry3 Game3AngryFriends Game3AngryStrangers
## 1            2           2           3                 3                   2
## 2            2           2           3                 4                   4
## 3            2           1           6                 5                   4
## 4            3           5           6                 1                   3
## 5            2           2           5                 1                   1
## 6            1           3           1                 1                   1
## 7            2           1           6                 1                   3
## 8            1           1           5                 4                   3
## 9            6           4           7                 2                   2
## 10           1           1           5                 2                   2
## 11           5           1           3                 3                   2
## 12           4           2           7                 3                   5
## 13           3           4           6                 2                   2
## 14           2           1           6                 1                   1
## 15           1           2           4                 2                   1
## 16           3           1           4                 5                   6
## 17           2           2           7                 4                   3
## 18           2           1           6                 1                   1
## 19           4           2           2                 2                   2
## 20           1           1           3                 1                   1
## 21           4           3           6                 1                   1
## 22           1           2           5                 1                   1
## 23           1           4           7                 3                   5
## 24           3           1           7                 1                   1
## 25           1           2           5                 1                   1
## 26           3           1           7                 3                   2
## 27           4           2           7                 1                   1
## 28           1           1           4                 2                   2
## 29           4           3           6                 4                   2
## 30           2           5           5                 2                   2
## 31           4           1           6                 1                   1
## 32           2           3           5                 2                   2
## 33           3           2           5                 1                   1
## 34           4           1           6                 2                   3
## 35           4           1           1                 4                   4
## 36           1           1           3                 1                   1
## 37           1           1           7                 2                   1
## 38           5           4           7                 3                   4
## 39           6           6           5                 5                   3
## 40           4           2           6                 1                   7
## 41           1           3           7                 1                   2
## 42           4           3           7                 3                   4
## 43           2           2           3                 3                   3
## 44           6           6           2                 2                   4
## 45           4           2           5                 4                   4
## 46           1           1           7                 4                   3
## 47           3           2           6                 3                   3
## 48           1           1           3                 1                   1
## 49           1           2           6                 2                   1
## 50           3           4           6                 2                   2
## 51           3           1           5                 2                   3
## 52           1           1           3                 1                   1
## 53           3           3           7                 2                   4
## 54           1           1           5                 1                   1
## 55           2           2           4                 2                   1
## 56           4           1           7                 2                   3
## 57           5           5           7                 1                   2
## 58           3           3           6                 1                   1
## 59           1           1           7                 1                   1
## 60           4           1           5                 3                   1
## 61           5           1           6                 1                   2
## 62           4           2           7                 2                   2
## 63           2           1           1                 1                   1
## 64           1           1           7                 1                   1
## 65           1           1           5                 1                   1
## 66           6           4           6                 4                   4
## 67           1           2           7                 1                   1
## 68           1           1           5                 1                   1
## 69           1           1           7                 2                   1
## 70           4           6           5                 2                   2
## 71           5           2           7                 1                   1
## 72           2           2           5                 1                   2
## 73           2           2           6                 1                   2
## 74           2           1           6                 1                   1
## 75           3           3           6                 1                   1
## 76           4           3           3                 4                   1
## 77           1           1           6                 3                   6
## 78           1           1           6                 1                   1
## 79           3           3           7                 4                   4
## 80           6           6           7                 4                   3
## 81           7           3           5                 1                   1
## 82           3           1           7                 1                   1
## 83           3           4           5                 2                   2
## 84           3           3           6                 2                   2
## 85           5           3           6                 1                   2
## 86           2           1           7                 1                   1
## 87           2           4           4                 1                   1
## 88           1           1           5                 2                   2
##    Game3CalmFriends Game3CalmStrangers Game3ExcitedFriends
## 1                 7                  6                   6
## 2                 3                  3                   4
## 3                 2                  2                   5
## 4                 5                  5                   6
## 5                 4                  3                   4
## 6                 7                  5                   7
## 7                 6                  5                   6
## 8                 6                  1                   6
## 9                 4                  3                   5
## 10                4                  3                   6
## 11                7                  6                   4
## 12                3                  2                   6
## 13                5                  4                   5
## 14                7                  7                   7
## 15                6                  4                   5
## 16                2                  2                   3
## 17                5                  5                   4
## 18                4                  3                   5
## 19                5                  5                   4
## 20                4                  4                   4
## 21                4                  4                   7
## 22                2                  2                   5
## 23                5                  2                   4
## 24                7                  7                   5
## 25                5                  5                   3
## 26                3                  2                   6
## 27                5                  3                   6
## 28                6                  6                   4
## 29                2                  3                   5
## 30                6                  3                   5
## 31                6                  6                   4
## 32                5                  5                   5
## 33                7                  7                   7
## 34                5                  5                   5
## 35                4                  4                   4
## 36                6                  5                   4
## 37                3                  2                   5
## 38                4                  4                   5
## 39                6                  4                   7
## 40                5                  1                   6
## 41                5                  4                   6
## 42                5                  4                   5
## 43                5                  5                   4
## 44                1                  5                   5
## 45                4                  4                   4
## 46                6                  7                   7
## 47                5                  5                   6
## 48                4                  5                   5
## 49                4                  4                   5
## 50                5                  5                   5
## 51                6                  5                   6
## 52                4                  5                   6
## 53                4                  5                   5
## 54                3                  3                   2
## 55                5                  4                   4
## 56                2                  2                   1
## 57                5                  4                   7
## 58                4                  5                   4
## 59                4                  4                   6
## 60                4                  4                   7
## 61                5                  4                   6
## 62                6                  6                   4
## 63                4                  4                   5
## 64                7                  7                   3
## 65                2                  2                   5
## 66                5                  6                   6
## 67                5                  4                   3
## 68                3                  3                   7
## 69                7                  6                   5
## 70                4                  5                   5
## 71                4                  5                   5
## 72                5                  5                   7
## 73                4                  2                   5
## 74                6                  7                   5
## 75                6                  6                   6
## 76                6                  3                   7
## 77                3                  3                   6
## 78                4                  6                   5
## 79                6                  4                   4
## 80                3                  2                   6
## 81                7                  7                   5
## 82                7                  7                   5
## 83                2                  3                   4
## 84                4                  4                   5
## 85                5                  6                   4
## 86                7                  2                   7
## 87                6                  4                   3
## 88                7                  6                   7
##    Game3ExcitedStrangers Game3Exciting1 Game3Exciting2 Game3Exciting3
## 1                      5              2              2              3
## 2                      4              3              6              2
## 3                      6              3              1              3
## 4                      5              3              1              3
## 5                      2              1              2              2
## 6                      6              1              1              4
## 7                      5              2              2              3
## 8                      3              1              2              2
## 9                      4              4              4              2
## 10                     6              1              1              1
## 11                     6              5              3              7
## 12                     5              3              1              2
## 13                     5              3              5              3
## 14                     7              3              6              3
## 15                     4              2              1              3
## 16                     3              3              3              3
## 17                     3              1              1              1
## 18                     4              2              5              3
## 19                     5              3              4              3
## 20                     4              4              1              5
## 21                     7              4              1              4
## 22                     3              3              2              2
## 23                     4              5              5              2
## 24                     5              2              2              2
## 25                     4              5              4              2
## 26                     4              2              2              4
## 27                     3              1              3              1
## 28                     4              2              3              2
## 29                     4              2              2              1
## 30                     4              2              1              2
## 31                     2              2              3              1
## 32                     5              5              7              6
## 33                     7              1              3              3
## 34                     5              4              2              2
## 35                     5              2              3              5
## 36                     4              1              1              1
## 37                     3              1              1              1
## 38                     3              5              5              5
## 39                     4              1              1              2
## 40                     4              3              5              6
## 41                     6              5              2              5
## 42                     5              3              2              2
## 43                     4              3              3              3
## 44                     6              2              6              2
## 45                     4              2              2              1
## 46                     7              1              1              1
## 47                     5              2              2              1
## 48                     7              2              5              5
## 49                     6              2              2              3
## 50                     6              3              5              4
## 51                     6              4              4              6
## 52                     6              1              3              1
## 53                     5              2              2              2
## 54                     1              1              1              4
## 55                     2              2              2              4
## 56                     1              5              1              1
## 57                     5              2              2              3
## 58                     4              2              3              4
## 59                     4              3              3              1
## 60                     5              4              2              4
## 61                     6              2              1              1
## 62                     5              2              2              6
## 63                     5              1              3              6
## 64                     2              1              1              1
## 65                     6              1              3              1
## 66                     6              4              3              3
## 67                     2              6              2              6
## 68                     5              1              1              1
## 69                     2              1              3              1
## 70                     5              1              3              1
## 71                     6              4              4              3
## 72                     7              2              1              4
## 73                     4              2              2              1
## 74                     4              1              1              1
## 75                     6              2              1              3
## 76                     4              5              6              3
## 77                     6              1              1              1
## 78                     4              1              1              1
## 79                     5              1              1              3
## 80                     5              3              2              2
## 81                     7              3              2              1
## 82                     1              1              1              1
## 83                     2              1              2              3
## 84                     5              2              4              2
## 85                     2              1              1              1
## 86                     3              2              1              1
## 87                     6              5              5              6
## 88                     7              2              1              1
##    Game3Neutral1 Game3Neutral2 Game3Neutral3 Game4Angry1 Game4Angry2
## 1              5             6             5           2           2
## 2              2             3             3           5           2
## 3              2             2             6           1           1
## 4              2             4             5           3           4
## 5              5             4             4           2           3
## 6              6             6             7           1           3
## 7              1             2             4           1           2
## 8              1             3             1           7           7
## 9              2             2             1           3           5
## 10             2             1             4           1           5
## 11             2             2             1           1           2
## 12             3             4             3           3           4
## 13             2             2             5           5           6
## 14             7             6             7           1           1
## 15             1             2             6           1           2
## 16             4             6             7           4           3
## 17             3             2             6           6           5
## 18             2             2             2           1           1
## 19             3             4             4           4           3
## 20             1             1             4           1           1
## 21             2             1             1           2           4
## 22             2             2             4           1           1
## 23             6             6             7           1           2
## 24             6             5             6           3           1
## 25             1             4             7           1           1
## 26             1             1             1           1           6
## 27             7             2             1           2           2
## 28             5             4             7           1           1
## 29             3             2             3           1           3
## 30             4             2             3           3           2
## 31             1             2             4           5           3
## 32             6             5             4           4           1
## 33             3             1             4           5           2
## 34             3             5             5           4           4
## 35             6             7             2           7           6
## 36             4             4             6           1           1
## 37             1             1             4           1           1
## 38             2             5             3           4           5
## 39             4             3             6           5           4
## 40             2             2             5           3           2
## 41             4             5             1           1           1
## 42             3             1             3           4           5
## 43             5             5             6           4           4
## 44             3             2             6           2           2
## 45             2             6             6           6           2
## 46             4             4             5           5           2
## 47             3             2             5           2           3
## 48             6             6             7           1           1
## 49             3             4             4           1           5
## 50             4             6             5           2           1
## 51             6             5             3           3           1
## 52             5             6             5           2           1
## 53             3             2             3           3           4
## 54             4             1             2           1           1
## 55             4             3             5           2           2
## 56             1             1             2           4           2
## 57             3             5             5           3           3
## 58             2             1             4           2           5
## 59             5             6             6           1           2
## 60             1             2             2           4           2
## 61             1             3             1           2           3
## 62             5             5             4           4           3
## 63             3             2             5           1           1
## 64             3             7             5           1           7
## 65             2             4             4           1           1
## 66             2             2             4           4           5
## 67             1             7             4           3           3
## 68             4             5             3           1           1
## 69             6             6             3           1           1
## 70             2             2             5           5           3
## 71             2             2             2           5           5
## 72             1             2             3           3           2
## 73             3             1             2           1           2
## 74             1             4             3           3           2
## 75             1             1             2           1           1
## 76             4             4             3           7           1
## 77             3             4             7           3           3
## 78             1             1             7           1           1
## 79             1             2             5           2           1
## 80             2             1             1           2           2
## 81             4             1             1           4           1
## 82             3             1             7           2           1
## 83             1             1             2           1           3
## 84             3             1             1           3           3
## 85             5             1             2           3           1
## 86             4             6             2           2           1
## 87             4             1             6           1           1
## 88             4             4             7           1           3
##    Game4Angry3 Game4AngryFriends Game4AngryStrangers Game4CalmFriends
## 1            2                 2                   2                5
## 2            2                 4                   5                2
## 3            2                 1                   1                2
## 4            3                 2                   3                5
## 5            3                 1                   2                4
## 6            1                 1                   1                4
## 7            3                 2                   2                4
## 8            1                 2                   1                1
## 9            5                 2                   2                1
## 10           1                 1                   4                3
## 11           1                 1                   2                4
## 12           2                 2                   2                3
## 13           4                 2                   1                3
## 14           2                 2                   1                7
## 15           3                 2                   5                5
## 16           2                 1                   1                3
## 17           3                 3                   3                4
## 18           2                 1                   1                7
## 19           3                 1                   1                5
## 20           2                 1                   1                4
## 21           1                 1                   1                7
## 22           2                 1                   1                3
## 23           3                 4                   5                3
## 24           3                 1                   1                7
## 25           2                 2                   2                4
## 26           1                 2                   1                3
## 27           3                 2                   1                2
## 28           1                 1                   1                4
## 29           1                 3                   5                3
## 30           3                 4                   3                2
## 31           3                 2                   2                5
## 32           4                 3                   4                6
## 33           4                 2                   1                2
## 34           2                 2                   2                5
## 35           1                 2                   2                4
## 36           2                 1                   1                4
## 37           3                 2                   6                3
## 38           5                 4                   3                3
## 39           4                 4                   2                6
## 40           2                 2                   1                3
## 41           4                 1                   1                5
## 42           6                 3                   4                4
## 43           3                 5                   5                4
## 44           4                 3                   4                6
## 45           3                 4                   4                4
## 46           6                 3                   2                5
## 47           3                 3                   2                4
## 48           4                 1                   1                7
## 49           6                 3                   2                4
## 50           2                 2                   2                5
## 51           2                 2                   2                5
## 52           3                 1                   1                3
## 53           5                 1                   1                6
## 54           1                 1                   5                4
## 55           5                 1                   2                4
## 56           6                 1                   1                1
## 57           3                 1                   2                3
## 58           2                 1                   1                5
## 59           5                 1                   1                4
## 60           5                 1                   3                2
## 61           2                 1                   1                5
## 62           3                 2                   3                4
## 63           1                 5                   4                3
## 64           4                 1                   1                4
## 65           5                 1                   1                6
## 66           4                 4                   4                4
## 67           5                 3                   1                6
## 68           1                 1                   1                1
## 69           1                 3                   1                6
## 70           4                 2                   2                5
## 71           6                 1                   1                1
## 72           5                 1                   1                4
## 73           1                 2                   2                3
## 74           2                 2                   2                2
## 75           2                 1                   1                2
## 76           5                 4                   2                5
## 77           2                 3                   2                7
## 78           1                 1                   1                1
## 79           5                 4                   4                6
## 80           1                 2                   1                4
## 81           3                 1                   1                6
## 82           1                 1                   1                1
## 83           3                 2                   2                3
## 84           2                 2                   3                5
## 85           4                 1                   1                7
## 86           7                 3                   4                2
## 87           1                 1                   1                7
## 88           1                 3                   3                5
##    Game4CalmStrangers Game4ExcitedFriends Game4ExcitedStrangers Game4Exciting1
## 1                   5                   7                     4              5
## 2                   4                   4                     5              7
## 3                   2                   4                     4              6
## 4                   5                   5                     6              1
## 5                   4                   5                     4              2
## 6                   3                   5                     5              6
## 7                   2                   7                     6              4
## 8                   1                   4                     1              4
## 9                   1                   6                     3              5
## 10                  4                   3                     6              1
## 11                  6                   7                     7              3
## 12                  5                   7                     4              4
## 13                  2                   6                     4              3
## 14                  7                   7                     7              3
## 15                  4                   7                     4              2
## 16                  2                   7                     5              4
## 17                  3                   7                     5              2
## 18                  6                   3                     2              4
## 19                  4                   3                     6              2
## 20                  5                   5                     4              4
## 21                  4                   7                     7              6
## 22                  4                   5                     4              1
## 23                  2                   5                     2              1
## 24                  6                   3                     2              3
## 25                  6                   4                     4              4
## 26                  4                   7                     6              4
## 27                  4                   7                     6              3
## 28                  4                   7                     4              1
## 29                  4                   3                     4              4
## 30                  2                   2                     6              2
## 31                  4                   4                     4              6
## 32                  6                   5                     6              3
## 33                  2                   7                     2              3
## 34                  5                   6                     5              4
## 35                  3                   5                     3              5
## 36                  5                   3                     5              1
## 37                  2                   7                     4              1
## 38                  3                   5                     5              2
## 39                  5                   7                     5              2
## 40                  5                   7                     6              4
## 41                  4                   7                     5              6
## 42                  5                   4                     5              1
## 43                  4                   4                     3              6
## 44                  4                   6                     3              2
## 45                  4                   4                     4              3
## 46                  4                   7                     7              2
## 47                  4                   5                     5              4
## 48                  3                   7                     5              1
## 49                  5                   6                     6              3
## 50                  4                   5                     5              5
## 51                  4                   7                     7              4
## 52                  2                   6                     7              3
## 53                  6                   4                     4              3
## 54                  4                   4                     4              1
## 55                  3                   6                     3              3
## 56                  1                   7                     6              3
## 57                  1                   7                     6              5
## 58                  4                   6                     5              3
## 59                  2                   7                     6              3
## 60                  1                   7                     6              3
## 61                  2                   7                     6              5
## 62                  3                   7                     5              3
## 63                  3                   4                     3              2
## 64                  4                   5                     5              7
## 65                  3                   6                     3              1
## 66                  4                   7                     5              4
## 67                  2                   6                     6              4
## 68                  1                   7                     7              7
## 69                  5                   3                     4              1
## 70                  1                   7                     6              5
## 71                  1                   7                     7              6
## 72                  4                   7                     7              5
## 73                  4                   7                     6              1
## 74                  5                   4                     6              2
## 75                  2                   6                     5              2
## 76                  2                   7                     3              7
## 77                  5                   6                     6              1
## 78                  1                   5                     5              1
## 79                  5                   7                     7              1
## 80                  3                   5                     4              5
## 81                  5                   7                     7              3
## 82                  1                   7                     7              7
## 83                  2                   4                     4              1
## 84                  3                   5                     4              3
## 85                  7                   7                     7              2
## 86                  6                   7                     7              4
## 87                  5                   7                     5              5
## 88                  4                   7                     7              2
##    Game4Exciting2 Game4Exciting3 Game4Neutral1 Game4Neutral2 Game4Neutral3
## 1               5              2             1             5             2
## 2               4              5             3             2             4
## 3               6              6             4             5             2
## 4               5              5             4             2             5
## 5               4              3             3             5             5
## 6               5              6             1             1             1
## 7               5              6             3             2             2
## 8               7              3             6             2             2
## 9               6              4             2             4             2
## 10              4              5             1             5             2
## 11              4              6             4             5             1
## 12              6              2             3             3             3
## 13              5              3             5             5             2
## 14              6              5             7             7             7
## 15              2              4             2             3             4
## 16              6              5             7             3             3
## 17              2              2             1             2             1
## 18              5              4             6             7             6
## 19              4              5             4             5             3
## 20              3              2             2             1             2
## 21              3              1             5             1             2
## 22              3              2             5             3             5
## 23              5              4             7             7             5
## 24              5              5             6             6             7
## 25              3              4             3             3             1
## 26              5              6             1             1             1
## 27              1              4             6             6             1
## 28              4              4             7             7             5
## 29              7              5             6             5             2
## 30              4              5             4             2             3
## 31              5              5             4             4             2
## 32              5              5             7             6             4
## 33              7              6             4             5             3
## 34              5              5             4             3             3
## 35              7              6             3             4             7
## 36              2              1             6             5             4
## 37              5              1             4             6             4
## 38              6              5             3             4             3
## 39              2              5             3             2             6
## 40              6              6             4             1             1
## 41              3              3             5             2             2
## 42              4              2             2             5             4
## 43              5              6             5             3             2
## 44              2              2             4             1             2
## 45              1              3             1             5             4
## 46              3              5             6             6             4
## 47              4              6             5             3             3
## 48              7              2             5             6             6
## 49              4              7             3             5             4
## 50              6              5             4             5             4
## 51              7              5             6             1             1
## 52              6              7             6             3             2
## 53              6              5             6             6             2
## 54              1              2             3             1             2
## 55              6              3             5             5             4
## 56              3              3             5             1             1
## 57              5              5             4             4             4
## 58              7              5             6             4             1
## 59              7              5             7             7             3
## 60              3              6             1             3             3
## 61              6              7             5             2             1
## 62              5              6             6             5             3
## 63              3              3             3             2             4
## 64              3              4             6             7             1
## 65              2              1             2             3             4
## 66              4              5             3             2             2
## 67              2              4             6             3             1
## 68              7              6             4             4             4
## 69              1              1             5             6             5
## 70              6              6             1             2             4
## 71              7              5             2             2             2
## 72              2              4             4             2             1
## 73              5              5             5             4             1
## 74              5              1             2             1             1
## 75              4              1             7             7             1
## 76              7              7             4             3             2
## 77              6              1             6             6             6
## 78              5              4             7             7             1
## 79              4              6             7             5             3
## 80              7              5             6             6             4
## 81              6              7             1             1             1
## 82              7              7             3             3             2
## 83              4              1             1             1             4
## 84              5              5             3             4             1
## 85              5              5             5             5             4
## 86              1              2             5             3             1
## 87              4              7             5             5             3
## 88              4              5             1             2             5
##    DoNotUseVideoGamePerformanceData DinerDashWithMusicScore
## 1                                NA                    5830
## 2                                NA                    5370
## 3                                 1                    6921
## 4                                 1                    6750
## 5                                NA                    6380
## 6                                 1                    5170
## 7                                 1                    5690
## 8                                NA                    6440
## 9                                NA                    5480
## 10                               NA                    6210
## 11                               NA                    6270
## 12                                1                    6150
## 13                                1                    7440
## 14                                1                    5660
## 15                               NA                    6810
## 16                                1                    5950
## 17                               NA                    6160
## 18                                1                    6240
## 19                               NA                    6650
## 20                               NA                    6500
## 21                               NA                    5770
## 22                               NA                    5950
## 23                               NA                    5550
## 24                               NA                    6560
## 25                                1                    6190
## 26                                1                    5930
## 27                                1                    5990
## 28                                1                    6160
## 29                                1                    5020
## 30                                1                    5000
## 31                                1                    5970
## 32                                1                    6440
## 33                               NA                    6010
## 34                               NA                    5730
## 35                                1                    5240
## 36                               NA                    7430
## 37                                1                    5740
## 38                                1                    5840
## 39                               NA                    5790
## 40                               NA                    6410
## 41                               NA                    7310
## 42                               NA                    6460
## 43                               NA                    6820
## 44                                1                    5000
## 45                               NA                    5100
## 46                                1                    6100
## 47                               NA                    5920
## 48                                1                    6170
## 49                                1                    5000
## 50                               NA                    5990
## 51                               NA                    5670
## 52                               NA                    5000
## 53                                1                    5170
## 54                                1                    5990
## 55                               NA                    5620
## 56                               NA                    6080
## 57                               NA                    5830
## 58                               NA                    6200
## 59                                1                    6790
## 60                                1                    6130
## 61                                1                    5060
## 62                                1                    6500
## 63                                1                    3460
## 64                                1                    6000
## 65                               NA                    5170
## 66                               NA                    5650
## 67                               NA                    5600
## 68                               NA                    5900
## 69                               NA                    5660
## 70                                1                    7440
## 71                               NA                    6480
## 72                               NA                    5430
## 73                                1                    6160
## 74                                1                    5350
## 75                                1                    5060
## 76                                1                    5260
## 77                                1                    5970
## 78                                1                      NA
## 79                               NA                    5670
## 80                               NA                    5960
## 81                               NA                    5630
## 82                               NA                    3290
## 83                               NA                    6150
## 84                               NA                    5940
## 85                                1                    5170
## 86                               NA                    5866
## 87                                1                    5820
## 88                               NA                    5000
##    DinerDashWithoutMusicScore SOFMusicEnemies SOFNoMusicEnemies
## 1                        5000              19                22
## 2                        1250              23                15
## 3                        6742              19                 3
## 4                        5060              23                18
## 5                        5840              24                23
## 6                        5020              20                 7
## 7                        5000               1                17
## 8                        6460              16                18
## 9                        2990              24                16
## 10                       5090              26                19
## 11                       5490              23                23
## 12                       5140              23                 2
## 13                         NA              25                29
## 14                       5000              10                 0
## 15                       5200              26                24
## 16                       3040              15                 0
## 17                       5140              23                19
## 18                       5370              21                15
## 19                       5170              23                21
## 20                       3000              14                10
## 21                       5000              23                21
## 22                       5060              15                16
## 23                       5000              27                25
## 24                       5020              24                24
## 25                       5370              26                 1
## 26                       5000               1                 3
## 27                       5000              19                10
## 28                       5960              26                20
## 29                        970              14                 2
## 30                       1090              12                12
## 31                       5000              19                15
## 32                       5000              NA                25
## 33                       5000              23                25
## 34                       5060              24                18
## 35                       5060               7                15
## 36                       5840              26                24
## 37                       5000               0                 0
## 38                       3340              14                20
## 39                       4189              25                15
## 40                       5090              23                19
## 41                       5000              30                27
## 42                       5170              22                24
## 43                       5060              23                13
## 44                       5000               1                 1
## 45                       5000              28                27
## 46                       5000              25                 2
## 47                       5370              24                17
## 48                       5680               0                17
## 49                       5000              NA                 8
## 50                       5000              23                23
## 51                       5530              24                25
## 52                       3140              23                24
## 53                       5000               4                11
## 54                       5000              17                 9
## 55                       2870              24                24
## 56                       5150              26                22
## 57                       5000              23                23
## 58                       5490              26                18
## 59                       5000              18                21
## 60                       5210              23                21
## 61                       2200               0                 1
## 62                       5170              13                20
## 63                       5000              NA                13
## 64                       5670              23                 8
## 65                       1210              27                19
## 66                       2960              19                21
## 67                       5170              25                24
## 68                       5860              28                16
## 69                       5000              26                19
## 70                       5020              23                16
## 71                       6180              36                27
## 72                       3160              24                24
## 73                       5430              11                15
## 74                       5500              25                 6
## 75                       2180              25                15
## 76                       5000              17                 2
## 77                       5140              20                17
## 78                         NA              NA                NA
## 79                       5070              27                21
## 80                       5060              28                20
## 81                       5060              26                17
## 82                       2870              19                 7
## 83                       6000              30                25
## 84                       5000              18                19
## 85                       5000              25                15
## 86                       5000              27                24
## 87                       3280              31                 7
## 88                       3040              26                22

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"))
rating_hyp_d
##    Subject Cond Game1Angry1 Game1Angry2 Game1Angry3 Game1AngryFriends
## 1        1    2           6           6           5                 2
## 2        3    1           6           5           7                 2
## 3        6    6           5           5           6                 3
## 4        9    5           4           1           4                 7
## 5       10    1           7           5           7                 6
## 6       11    2           3           4           3                 3
## 7       12    4           5           6           1                 7
## 8       16    3           4           5           5                 4
## 9       18    1           7           7           5                 5
## 10      20    3           5           3           7                 6
## 11      21    6           4           1           4                 1
## 12      22    5           4           2           2                 7
## 13      24    2           5           5           4                 3
## 14      25    2           4           7           6                 4
## 15      26    1           6           2           6                 1
## 16      35    2           2           2           3                 5
## 17      36    6           6           5           5                 6
## 18      38    6           1           5           4                 1
## 19      41    5           6           4           6                 3
## 20      42    2           6           6           7                 5
## 21      43    6           5           6           7                 5
## 22      44    2           5           6           5                 3
## 23      45    3           5           5           6                 5
## 24      47    4           4           2           5                 4
## 25      49    5           5           6           5                 4
## 26      52    1           5           3           4                 2
## 27      53    6           7           6           6                 2
## 28      54    2           3           6           7                 6
## 29      57    2           3           3           4                 1
## 30      58    5           5           1           7                 2
## 31      59    1           7           7           7                 5
## 32      60    6           6           7           5                 6
## 33      67    4           1           1           1                 1
## 34      68    3           6           7           6                 4
## 35      69    6           7           7           7                 6
## 36      70    2           5           5           7                 6
## 37      71    5           6           6           1                 6
## 38      73    1           3           1           4                 2
## 39      74    2           4           5           7                 2
## 40      81    5           5           5           7                 6
## 41      82    3           6           6           5                 5
## 42      83    4           7           6           4                 1
## 43      84    4           7           7           7                 4
## 44      85    5           2           5           4                 1
## 45      86    3           4           3           6                 2
## 46      88    6           7           7           5                 4
## 47      90    3           5           5           5                 7
##    Game1AngryStrangers Game1CalmFriends Game1CalmStrangers Game1ExcitedFriends
## 1                    5                2                  2                   1
## 2                    2                2                  2                   2
## 3                    4                5                  4                   6
## 4                    7                4                  5                   3
## 5                    6                2                  2                   5
## 6                    5                1                  2                   2
## 7                    7                3                  3                   4
## 8                    7                2                  1                   1
## 9                    6                2                  3                   3
## 10                   7                2                  2                   4
## 11                   1                1                  1                   2
## 12                   7                2                  2                   2
## 13                   5                1                  1                   1
## 14                   5                2                  2                   5
## 15                   1                7                  7                   5
## 16                   6                4                  4                   2
## 17                   5                2                  2                   4
## 18                   1                6                  5                   4
## 19                   7                1                  2                   4
## 20                   7                2                  2                   6
## 21                   7                1                  1                   2
## 22                   4                5                  3                   5
## 23                   5                3                  3                   4
## 24                   4                4                  4                   4
## 25                   5                4                  4                   5
## 26                   3                5                  4                   5
## 27                   4                4                  3                   6
## 28                   6                3                  3                   4
## 29                   4                1                  1                   1
## 30                   1                4                  4                   3
## 31                   7                2                  2                   4
## 32                   7                1                  2                   5
## 33                   1                3                  3                   4
## 34                   7                1                  4                   3
## 35                   4                3                  2                   5
## 36                   6                1                  1                   1
## 37                   4                3                  1                   5
## 38                   7                2                  2                   2
## 39                   7                4                  2                   7
## 40                   5                4                  5                   5
## 41                   6                3                  1                   5
## 42                   6                2                  1                   7
## 43                   7                1                  1                   1
## 44                   1                1                  1                   1
## 45                   3                2                  2                   5
## 46                   1                4                  4                   7
## 47                   7                1                  1                   4
##    Game1ExcitedStrangers Game1Exciting1 Game1Exciting2 Game1Exciting3
## 1                      2              3              2              6
## 2                      2              2              3              4
## 3                      4              3              2              4
## 4                      2              3              4              2
## 5                      5              6              3              4
## 6                      3              1              5              1
## 7                      5              4              4              5
## 8                      3              3              1              3
## 9                      3              5              5              3
## 10                     4              2              1              2
## 11                     2              5              5              4
## 12                     4              2              1              2
## 13                     2              4              1              4
## 14                     6              2              4              6
## 15                     5              7              4              7
## 16                     1              1              5              1
## 17                     4              3              2              2
## 18                     4              1              4              2
## 19                     6              1              3              3
## 20                     4              4              3              5
## 21                     2              3              2              3
## 22                     5              3              4              3
## 23                     4              5              2              6
## 24                     4              1              1              1
## 25                     5              4              3              4
## 26                     5              4              2              2
## 27                     5              6              2              7
## 28                     4              1              1              1
## 29                     2              2              2              2
## 30                     6              1              1              1
## 31                     4              4              3              2
## 32                     4              3              3              4
## 33                     3              1              4              3
## 34                     5              3              3              4
## 35                     3              5              5              2
## 36                     1              1              1              1
## 37                     6              3              5              1
## 38                     2              5              5              3
## 39                     4              1              1              1
## 40                     3              1              2              3
## 41                     4              2              1              4
## 42                     7              6              1              1
## 43                     3              3              1              5
## 44                     1              1              1              3
## 45                     5              3              4              2
## 46                     4              7              7              6
## 47                     1              1              1              1
##    Game1Neutral1 Game1Neutral2 Game1Neutral3 Game2Angry1 Game2Angry2
## 1              2             4             4           6           4
## 2              1             2             3           5           3
## 3              2             2             4           6           5
## 4              2             1             1           1           1
## 5              1             2             1           6           5
## 6              1             1             2           6           5
## 7              1             1             1           7           7
## 8              1             1             2           1           4
## 9              2             3             1           7           7
## 10             1             1             1           4           4
## 11             1             1             2           4           2
## 12             1             1             1           4           5
## 13             1             1             1           4           4
## 14             1             2             2           1           6
## 15             1             4             3           7           4
## 16             2             3             5           4           5
## 17             2             2             1           5           4
## 18             3             6             3           1           1
## 19             2             3             4           6           6
## 20             2             3             1           6           6
## 21             1             1             1           3           2
## 22             3             2             2           5           5
## 23             3             4             2           6           5
## 24             1             7             7           3           2
## 25             3             3             3           7           6
## 26             2             3             3           5           2
## 27             3             1             1           6           6
## 28             1             1             1           5           6
## 29             2             2             2           4           4
## 30             1             1             1           6           5
## 31             2             5             3           7           7
## 32             3             2             1           5           5
## 33             3             4             1           4           1
## 34             2             2             2           5           5
## 35             1             3             2           5           7
## 36             1             1             1           5           7
## 37             1             1             1           4           6
## 38             3             3             2           4           3
## 39             1             1             1           4           7
## 40             1             3             4           3           4
## 41             1             1             1           4           5
## 42             1             1             1           7           7
## 43             1             1             2           7           7
## 44             2             1             2           1           1
## 45             3             3             2           4           4
## 46             2             1             1           7           7
## 47             1             1             6           5           1
##    Game2Angry3 Game2AngryFriends Game2AngryStrangers Game2CalmFriends
## 1            6                 3                   6                1
## 2            6                 3                   3                3
## 3            6                 3                   5                3
## 4            2                 1                   7                7
## 5            6                 6                   7                1
## 6            4                 5                   6                2
## 7            4                 6                   7                1
## 8            6                 3                   6                1
## 9            6                 4                   6                2
## 10           7                 6                   7                2
## 11           4                 1                   2                1
## 12           5                 7                   7                2
## 13           3                 2                   5                1
## 14           5                 7                   6                2
## 15           5                 1                   1                7
## 16           4                 4                   4                2
## 17           4                 4                   5                1
## 18           7                 1                   1                6
## 19           5                 4                   6                2
## 20           6                 5                   7                4
## 21           7                 5                   7                2
## 22           5                 6                   4                5
## 23           4                 6                   5                3
## 24           5                 4                   4                4
## 25           4                 5                   5                4
## 26           5                 3                   3                4
## 27           6                 2                   6                4
## 28           3                 5                   6                3
## 29           3                 2                   3                1
## 30           6                 1                   1                3
## 31           7                 6                   6                2
## 32           4                 5                   5                2
## 33           3                 4                   1                3
## 34           6                 4                   7                1
## 35           7                 7                   5                3
## 36           1                 6                   7                1
## 37           4                 7                   5                3
## 38           4                 5                   6                3
## 39           2                 3                   7                4
## 40           7                 4                   6                4
## 41           6                 5                   6                2
## 42           5                 6                   7                1
## 43           7                 1                   6                1
## 44           3                 1                   1                1
## 45           6                 2                   5                1
## 46           4                 1                   1                5
## 47           7                 7                   7                1
##    Game2CalmStrangers Game2ExcitedFriends Game2ExcitedStrangers Game2Exciting1
## 1                   2                   1                     1              3
## 2                   3                   3                     3              2
## 3                   2                   5                     4              2
## 4                   1                   4                     1              1
## 5                   2                   4                     3              7
## 6                   2                   4                     4              1
## 7                   3                   5                     5              6
## 8                   2                   3                     4              2
## 9                   4                   5                     4              2
## 10                  2                   4                     4              1
## 11                  1                   1                     1              4
## 12                  2                   4                     2              6
## 13                  1                   1                     3              1
## 14                  2                   5                     2              2
## 15                  5                   5                     6              1
## 16                  3                   2                     6              4
## 17                  2                   6                     1              2
## 18                  3                   3                     6              1
## 19                  2                   3                     5              1
## 20                  2                   3                     3              2
## 21                  1                   2                     3              1
## 22                  4                   4                     3              6
## 23                  4                   5                     5              3
## 24                  4                   4                     4              1
## 25                  4                   4                     5              2
## 26                  3                   4                     4              2
## 27                  2                   5                     3              2
## 28                  2                   2                     3              1
## 29                  1                   1                     1              3
## 30                  1                   2                     1              1
## 31                  2                   3                     4              3
## 32                  1                   7                     6              2
## 33                  3                   3                     3              3
## 34                  3                   2                     5              4
## 35                  2                   6                     5              3
## 36                  1                   1                     5              1
## 37                  1                   5                     5              3
## 38                  3                   3                     2              4
## 39                  4                   6                     7              3
## 40                  5                   3                     5              1
## 41                  1                   4                     5              2
## 42                  1                   1                     2              3
## 43                  1                   1                     1              2
## 44                  1                   1                     1              1
## 45                  1                   5                     5              1
## 46                  6                   7                     4              7
## 47                  1                   1                     4              3
##    Game2Exciting2 Game2Exciting3 Game2Neutral1 Game2Neutral2 Game2Neutral3
## 1               2              4             1             3             1
## 2               5              2             4             3             1
## 3               2              3             2             3             4
## 4               1              1             1             1             1
## 5               3              5             1             3             1
## 6               1              1             1             1             1
## 7               4              4             1             1             1
## 8               1              2             1             1             4
## 9               1              1             1             1             1
## 10              1              1             1             1             1
## 11              3              2             1             1             1
## 12              1              1             1             1             1
## 13              2              5             1             1             1
## 14              4              3             1             2             1
## 15              1              1             1             5             3
## 16              7              1             1             1             1
## 17              2              2             1             2             1
## 18              1              2             2             4             1
## 19              4              4             1             2             5
## 20              1              2             1             2             3
## 21              3              1             1             1             1
## 22              5              4             3             3             3
## 23              3              4             3             4             2
## 24              2              1             1             3             6
## 25              2              1             4             2             2
## 26              3              2             2             3             2
## 27              2              3             3             1             1
## 28              1              1             1             2             2
## 29              2              3             2             2             2
## 30              2              1             1             1             3
## 31              3              2             2             4             1
## 32              2              2             1             1             1
## 33              2              1             6             6             2
## 34              4              3             2             3             2
## 35              3              2             1             2             1
## 36              1              1             1             1             1
## 37              1              3             2             1             1
## 38              6              3             2             2             2
## 39              1              4             1             1             1
## 40              4              4             2             3             6
## 41              2              2             1             2             4
## 42              1              1             1             1             1
## 43              1              2             1             1             2
## 44              1              1             1             1             1
## 45              2              3             2             2             1
## 46              1              1             1             1             1
## 47              2              2             1             3             1
##    Game3Angry1 Game3Angry2 Game3Angry3 Game3AngryFriends Game3AngryStrangers
## 1            2           2           3                 3                   2
## 2            2           2           3                 4                   4
## 3            2           2           5                 1                   1
## 4            1           1           5                 4                   3
## 5            6           4           7                 2                   2
## 6            1           1           5                 2                   2
## 7            5           1           3                 3                   2
## 8            1           2           4                 2                   1
## 9            2           2           7                 4                   3
## 10           4           2           2                 2                   2
## 11           1           1           3                 1                   1
## 12           4           3           6                 1                   1
## 13           1           2           5                 1                   1
## 14           1           4           7                 3                   5
## 15           3           1           7                 1                   1
## 16           3           2           5                 1                   1
## 17           4           1           6                 2                   3
## 18           1           1           3                 1                   1
## 19           6           6           5                 5                   3
## 20           4           2           6                 1                   7
## 21           1           3           7                 1                   2
## 22           4           3           7                 3                   4
## 23           2           2           3                 3                   3
## 24           4           2           5                 4                   4
## 25           3           2           6                 3                   3
## 26           3           4           6                 2                   2
## 27           3           1           5                 2                   3
## 28           1           1           3                 1                   1
## 29           2           2           4                 2                   1
## 30           4           1           7                 2                   3
## 31           5           5           7                 1                   2
## 32           3           3           6                 1                   1
## 33           1           1           5                 1                   1
## 34           6           4           6                 4                   4
## 35           1           2           7                 1                   1
## 36           1           1           5                 1                   1
## 37           1           1           7                 2                   1
## 38           5           2           7                 1                   1
## 39           2           2           5                 1                   2
## 40           3           3           7                 4                   4
## 41           6           6           7                 4                   3
## 42           7           3           5                 1                   1
## 43           3           1           7                 1                   1
## 44           3           4           5                 2                   2
## 45           3           3           6                 2                   2
## 46           2           1           7                 1                   1
## 47           1           1           5                 2                   2
##    Game3CalmFriends Game3CalmStrangers Game3ExcitedFriends
## 1                 7                  6                   6
## 2                 3                  3                   4
## 3                 4                  3                   4
## 4                 6                  1                   6
## 5                 4                  3                   5
## 6                 4                  3                   6
## 7                 7                  6                   4
## 8                 6                  4                   5
## 9                 5                  5                   4
## 10                5                  5                   4
## 11                4                  4                   4
## 12                4                  4                   7
## 13                2                  2                   5
## 14                5                  2                   4
## 15                7                  7                   5
## 16                7                  7                   7
## 17                5                  5                   5
## 18                6                  5                   4
## 19                6                  4                   7
## 20                5                  1                   6
## 21                5                  4                   6
## 22                5                  4                   5
## 23                5                  5                   4
## 24                4                  4                   4
## 25                5                  5                   6
## 26                5                  5                   5
## 27                6                  5                   6
## 28                4                  5                   6
## 29                5                  4                   4
## 30                2                  2                   1
## 31                5                  4                   7
## 32                4                  5                   4
## 33                2                  2                   5
## 34                5                  6                   6
## 35                5                  4                   3
## 36                3                  3                   7
## 37                7                  6                   5
## 38                4                  5                   5
## 39                5                  5                   7
## 40                6                  4                   4
## 41                3                  2                   6
## 42                7                  7                   5
## 43                7                  7                   5
## 44                2                  3                   4
## 45                4                  4                   5
## 46                7                  2                   7
## 47                7                  6                   7
##    Game3ExcitedStrangers Game3Exciting1 Game3Exciting2 Game3Exciting3
## 1                      5              2              2              3
## 2                      4              3              6              2
## 3                      2              1              2              2
## 4                      3              1              2              2
## 5                      4              4              4              2
## 6                      6              1              1              1
## 7                      6              5              3              7
## 8                      4              2              1              3
## 9                      3              1              1              1
## 10                     5              3              4              3
## 11                     4              4              1              5
## 12                     7              4              1              4
## 13                     3              3              2              2
## 14                     4              5              5              2
## 15                     5              2              2              2
## 16                     7              1              3              3
## 17                     5              4              2              2
## 18                     4              1              1              1
## 19                     4              1              1              2
## 20                     4              3              5              6
## 21                     6              5              2              5
## 22                     5              3              2              2
## 23                     4              3              3              3
## 24                     4              2              2              1
## 25                     5              2              2              1
## 26                     6              3              5              4
## 27                     6              4              4              6
## 28                     6              1              3              1
## 29                     2              2              2              4
## 30                     1              5              1              1
## 31                     5              2              2              3
## 32                     4              2              3              4
## 33                     6              1              3              1
## 34                     6              4              3              3
## 35                     2              6              2              6
## 36                     5              1              1              1
## 37                     2              1              3              1
## 38                     6              4              4              3
## 39                     7              2              1              4
## 40                     5              1              1              3
## 41                     5              3              2              2
## 42                     7              3              2              1
## 43                     1              1              1              1
## 44                     2              1              2              3
## 45                     5              2              4              2
## 46                     3              2              1              1
## 47                     7              2              1              1
##    Game3Neutral1 Game3Neutral2 Game3Neutral3 Game4Angry1 Game4Angry2
## 1              5             6             5           2           2
## 2              2             3             3           5           2
## 3              5             4             4           2           3
## 4              1             3             1           7           7
## 5              2             2             1           3           5
## 6              2             1             4           1           5
## 7              2             2             1           1           2
## 8              1             2             6           1           2
## 9              3             2             6           6           5
## 10             3             4             4           4           3
## 11             1             1             4           1           1
## 12             2             1             1           2           4
## 13             2             2             4           1           1
## 14             6             6             7           1           2
## 15             6             5             6           3           1
## 16             3             1             4           5           2
## 17             3             5             5           4           4
## 18             4             4             6           1           1
## 19             4             3             6           5           4
## 20             2             2             5           3           2
## 21             4             5             1           1           1
## 22             3             1             3           4           5
## 23             5             5             6           4           4
## 24             2             6             6           6           2
## 25             3             2             5           2           3
## 26             4             6             5           2           1
## 27             6             5             3           3           1
## 28             5             6             5           2           1
## 29             4             3             5           2           2
## 30             1             1             2           4           2
## 31             3             5             5           3           3
## 32             2             1             4           2           5
## 33             2             4             4           1           1
## 34             2             2             4           4           5
## 35             1             7             4           3           3
## 36             4             5             3           1           1
## 37             6             6             3           1           1
## 38             2             2             2           5           5
## 39             1             2             3           3           2
## 40             1             2             5           2           1
## 41             2             1             1           2           2
## 42             4             1             1           4           1
## 43             3             1             7           2           1
## 44             1             1             2           1           3
## 45             3             1             1           3           3
## 46             4             6             2           2           1
## 47             4             4             7           1           3
##    Game4Angry3 Game4AngryFriends Game4AngryStrangers Game4CalmFriends
## 1            2                 2                   2                5
## 2            2                 4                   5                2
## 3            3                 1                   2                4
## 4            1                 2                   1                1
## 5            5                 2                   2                1
## 6            1                 1                   4                3
## 7            1                 1                   2                4
## 8            3                 2                   5                5
## 9            3                 3                   3                4
## 10           3                 1                   1                5
## 11           2                 1                   1                4
## 12           1                 1                   1                7
## 13           2                 1                   1                3
## 14           3                 4                   5                3
## 15           3                 1                   1                7
## 16           4                 2                   1                2
## 17           2                 2                   2                5
## 18           2                 1                   1                4
## 19           4                 4                   2                6
## 20           2                 2                   1                3
## 21           4                 1                   1                5
## 22           6                 3                   4                4
## 23           3                 5                   5                4
## 24           3                 4                   4                4
## 25           3                 3                   2                4
## 26           2                 2                   2                5
## 27           2                 2                   2                5
## 28           3                 1                   1                3
## 29           5                 1                   2                4
## 30           6                 1                   1                1
## 31           3                 1                   2                3
## 32           2                 1                   1                5
## 33           5                 1                   1                6
## 34           4                 4                   4                4
## 35           5                 3                   1                6
## 36           1                 1                   1                1
## 37           1                 3                   1                6
## 38           6                 1                   1                1
## 39           5                 1                   1                4
## 40           5                 4                   4                6
## 41           1                 2                   1                4
## 42           3                 1                   1                6
## 43           1                 1                   1                1
## 44           3                 2                   2                3
## 45           2                 2                   3                5
## 46           7                 3                   4                2
## 47           1                 3                   3                5
##    Game4CalmStrangers Game4ExcitedFriends Game4ExcitedStrangers Game4Exciting1
## 1                   5                   7                     4              5
## 2                   4                   4                     5              7
## 3                   4                   5                     4              2
## 4                   1                   4                     1              4
## 5                   1                   6                     3              5
## 6                   4                   3                     6              1
## 7                   6                   7                     7              3
## 8                   4                   7                     4              2
## 9                   3                   7                     5              2
## 10                  4                   3                     6              2
## 11                  5                   5                     4              4
## 12                  4                   7                     7              6
## 13                  4                   5                     4              1
## 14                  2                   5                     2              1
## 15                  6                   3                     2              3
## 16                  2                   7                     2              3
## 17                  5                   6                     5              4
## 18                  5                   3                     5              1
## 19                  5                   7                     5              2
## 20                  5                   7                     6              4
## 21                  4                   7                     5              6
## 22                  5                   4                     5              1
## 23                  4                   4                     3              6
## 24                  4                   4                     4              3
## 25                  4                   5                     5              4
## 26                  4                   5                     5              5
## 27                  4                   7                     7              4
## 28                  2                   6                     7              3
## 29                  3                   6                     3              3
## 30                  1                   7                     6              3
## 31                  1                   7                     6              5
## 32                  4                   6                     5              3
## 33                  3                   6                     3              1
## 34                  4                   7                     5              4
## 35                  2                   6                     6              4
## 36                  1                   7                     7              7
## 37                  5                   3                     4              1
## 38                  1                   7                     7              6
## 39                  4                   7                     7              5
## 40                  5                   7                     7              1
## 41                  3                   5                     4              5
## 42                  5                   7                     7              3
## 43                  1                   7                     7              7
## 44                  2                   4                     4              1
## 45                  3                   5                     4              3
## 46                  6                   7                     7              4
## 47                  4                   7                     7              2
##    Game4Exciting2 Game4Exciting3 Game4Neutral1 Game4Neutral2 Game4Neutral3
## 1               5              2             1             5             2
## 2               4              5             3             2             4
## 3               4              3             3             5             5
## 4               7              3             6             2             2
## 5               6              4             2             4             2
## 6               4              5             1             5             2
## 7               4              6             4             5             1
## 8               2              4             2             3             4
## 9               2              2             1             2             1
## 10              4              5             4             5             3
## 11              3              2             2             1             2
## 12              3              1             5             1             2
## 13              3              2             5             3             5
## 14              5              4             7             7             5
## 15              5              5             6             6             7
## 16              7              6             4             5             3
## 17              5              5             4             3             3
## 18              2              1             6             5             4
## 19              2              5             3             2             6
## 20              6              6             4             1             1
## 21              3              3             5             2             2
## 22              4              2             2             5             4
## 23              5              6             5             3             2
## 24              1              3             1             5             4
## 25              4              6             5             3             3
## 26              6              5             4             5             4
## 27              7              5             6             1             1
## 28              6              7             6             3             2
## 29              6              3             5             5             4
## 30              3              3             5             1             1
## 31              5              5             4             4             4
## 32              7              5             6             4             1
## 33              2              1             2             3             4
## 34              4              5             3             2             2
## 35              2              4             6             3             1
## 36              7              6             4             4             4
## 37              1              1             5             6             5
## 38              7              5             2             2             2
## 39              2              4             4             2             1
## 40              4              6             7             5             3
## 41              7              5             6             6             4
## 42              6              7             1             1             1
## 43              7              7             3             3             2
## 44              4              1             1             1             4
## 45              5              5             3             4             1
## 46              1              2             5             3             1
## 47              4              5             1             2             5

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"),
        starts_with("DinerDash"),
        starts_with("SOF")) # your code here: remove the columns containing "Game" in the name



performance_hyp_d
##    Subject Cond DinerDashWithMusicScore DinerDashWithoutMusicScore
## 1        1    2                    5830                       5000
## 2        3    1                    5370                       1250
## 3        4    4                    6921                       6742
## 4        5    5                    6750                       5060
## 5        6    6                    6380                       5840
## 6        7    3                    5170                       5020
## 7        8    6                    5690                       5000
## 8        9    5                    6440                       6460
## 9       10    1                    5480                       2990
## 10      11    2                    6210                       5090
## 11      12    4                    6270                       5490
## 12      13    4                    6150                       5140
## 13      14    6                    7440                         NA
## 14      15    2                    5660                       5000
## 15      16    3                    6810                       5200
## 16      17    5                    5950                       3040
## 17      18    1                    6160                       5140
## 18      19    4                    6240                       5370
## 19      20    3                    6650                       5170
## 20      21    6                    6500                       3000
## 21      22    5                    5770                       5000
## 22      24    2                    5950                       5060
## 23      25    2                    5550                       5000
## 24      26    1                    6560                       5020
## 25      27    3                    6190                       5370
## 26      28    4                    5930                       5000
## 27      29    6                    5990                       5000
## 28      30    5                    6160                       5960
## 29      31    4                    5020                        970
## 30      32    5                    5000                       1090
## 31      33    3                    5970                       5000
## 32      34    1                    6440                       5000
## 33      35    2                    6010                       5000
## 34      36    6                    5730                       5060
## 35      37    1                    5240                       5060
## 36      38    6                    7430                       5840
## 37      39    4                    5740                       5000
## 38      40    3                    5840                       3340
## 39      41    5                    5790                       4189
## 40      42    2                    6410                       5090
## 41      43    6                    7310                       5000
## 42      44    2                    6460                       5170
## 43      45    3                    6820                       5060
## 44      46    1                    5000                       5000
## 45      47    4                    5100                       5000
## 46      48    5                    6100                       5000
## 47      49    5                    5920                       5370
## 48      50    3                    6170                       5680
## 49      51    4                    5000                       5000
## 50      52    1                    5990                       5000
## 51      53    6                    5670                       5530
## 52      54    2                    5000                       3140
## 53      55    4                    5170                       5000
## 54      56    3                    5990                       5000
## 55      57    2                    5620                       2870
## 56      58    5                    6080                       5150
## 57      59    1                    5830                       5000
## 58      60    6                    6200                       5490
## 59      61    3                    6790                       5000
## 60      62    6                    6130                       5210
## 61      63    1                    5060                       2200
## 62      64    2                    6500                       5170
## 63      65    4                    3460                       5000
## 64      66    5                    6000                       5670
## 65      67    4                    5170                       1210
## 66      68    3                    5650                       2960
## 67      69    6                    5600                       5170
## 68      70    2                    5900                       5860
## 69      71    5                    5660                       5000
## 70      72    1                    7440                       5020
## 71      73    1                    6480                       6180
## 72      74    2                    5430                       3160
## 73      75    6                    6160                       5430
## 74      76    5                    5350                       5500
## 75      77    4                    5060                       2180
## 76      78    3                    5260                       5000
## 77      79    6                    5970                       5140
## 78      80    2                      NA                         NA
## 79      81    5                    5670                       5070
## 80      82    3                    5960                       5060
## 81      83    4                    5630                       5060
## 82      84    4                    3290                       2870
## 83      85    5                    6150                       6000
## 84      86    3                    5940                       5000
## 85      87    1                    5170                       5000
## 86      88    6                    5866                       5000
## 87      89    2                    5820                       3280
## 88      90    3                    5000                       3040
##    SOFMusicEnemies SOFNoMusicEnemies
## 1               19                22
## 2               23                15
## 3               19                 3
## 4               23                18
## 5               24                23
## 6               20                 7
## 7                1                17
## 8               16                18
## 9               24                16
## 10              26                19
## 11              23                23
## 12              23                 2
## 13              25                29
## 14              10                 0
## 15              26                24
## 16              15                 0
## 17              23                19
## 18              21                15
## 19              23                21
## 20              14                10
## 21              23                21
## 22              15                16
## 23              27                25
## 24              24                24
## 25              26                 1
## 26               1                 3
## 27              19                10
## 28              26                20
## 29              14                 2
## 30              12                12
## 31              19                15
## 32              NA                25
## 33              23                25
## 34              24                18
## 35               7                15
## 36              26                24
## 37               0                 0
## 38              14                20
## 39              25                15
## 40              23                19
## 41              30                27
## 42              22                24
## 43              23                13
## 44               1                 1
## 45              28                27
## 46              25                 2
## 47              24                17
## 48               0                17
## 49              NA                 8
## 50              23                23
## 51              24                25
## 52              23                24
## 53               4                11
## 54              17                 9
## 55              24                24
## 56              26                22
## 57              23                23
## 58              26                18
## 59              18                21
## 60              23                21
## 61               0                 1
## 62              13                20
## 63              NA                13
## 64              23                 8
## 65              27                19
## 66              19                21
## 67              25                24
## 68              28                16
## 69              26                19
## 70              23                16
## 71              36                27
## 72              24                24
## 73              11                15
## 74              25                 6
## 75              25                15
## 76              17                 2
## 77              20                17
## 78              NA                NA
## 79              27                21
## 80              28                20
## 81              26                17
## 82              19                 7
## 83              30                25
## 84              18                19
## 85              25                15
## 86              27                24
## 87              31                 7
## 88              26                22

Converting to long form

Now we want to convert the data to long form, to make the rest of our manipulations easier. To do this, we can use pivot_longer on the target 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 %>% pivot_longer(cols=-c("Subject", "Cond"), # this tells it to transform all columns *except* these ones
                             names_to='Measurement', 
                             values_to='Value')
## # A tibble: 8 x 4
##   Subject  Cond Measurement                Value
##     <dbl> <dbl> <chr>                      <dbl>
## 1       1     2 DinerDashWithMusicScore     5830
## 2       1     2 DinerDashWithoutMusicScore  5000
## 3       1     2 SOFMusicEnemies               19
## 4       1     2 SOFNoMusicEnemies             22
## 5       3     1 DinerDashWithMusicScore     5370
## 6       3     1 DinerDashWithoutMusicScore  1250
## 7       3     1 SOFMusicEnemies               23
## 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 %>%
  pivot_longer(cols=-c("Subject", "Cond"),
               names_to='Measurement', 
               values_to='Score')

head(performance_hyp_long_d)
## # A tibble: 6 x 4
##   Subject  Cond Measurement                Score
##     <dbl> <dbl> <chr>                      <dbl>
## 1       1     2 DinerDashWithMusicScore     5830
## 2       1     2 DinerDashWithoutMusicScore  5000
## 3       1     2 SOFMusicEnemies               19
## 4       1     2 SOFNoMusicEnemies             22
## 5       3     1 DinerDashWithMusicScore     5370
## 6       3     1 DinerDashWithoutMusicScore  1250

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 %>%
  pivot_longer(cols=-c("Subject","Cond"),   ## your code here
               names_to="Measurement",
              values_to="Rating")

head(rating_hyp_long_d)
## # A tibble: 6 x 4
##   Subject  Cond Measurement         Rating
##     <dbl> <dbl> <chr>                <dbl>
## 1       1     2 Game1Angry1              6
## 2       1     2 Game1Angry2              6
## 3       1     2 Game1Angry3              5
## 4       1     2 Game1AngryFriends        2
## 5       1     2 Game1AngryStrangers      5
## 6       1     2 Game1CalmFriends         2

Splitting columns

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

head(performance_hyp_long_d)
## # A tibble: 6 x 7
##   Subject  Cond Measurement      Score Confrontational… WithMusic MusicCondition
##     <dbl> <dbl> <chr>            <dbl> <lgl>            <lgl>     <fct>         
## 1       1     2 DinerDashWithMu…  5830 FALSE            TRUE      Exciting      
## 2       1     2 DinerDashWithou…  5000 FALSE            FALSE     Exciting      
## 3       1     2 SOFMusicEnemies     19 TRUE             TRUE      Exciting      
## 4       1     2 SOFNoMusicEnemi…    22 TRUE             FALSE     Exciting      
## 5       3     1 DinerDashWithMu…  5370 FALSE            TRUE      Anger         
## 6       3     1 DinerDashWithou…  1250 FALSE            FALSE     Anger

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
  )

head(rating_hyp_long_d)
## # A tibble: 6 x 5
##   Subject  Cond Measurement         Rating IsRecall
##     <dbl> <dbl> <chr>                <dbl> <lgl>   
## 1       1     2 Game1Angry1              6 FALSE   
## 2       1     2 Game1Angry2              6 FALSE   
## 3       1     2 Game1Angry3              5 FALSE   
## 4       1     2 Game1AngryFriends        2 TRUE    
## 5       1     2 Game1AngryStrangers      5 TRUE    
## 6       1     2 Game1CalmFriends         2 TRUE

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))
    ) 
head(rating_hyp_long_d)
## # A tibble: 6 x 8
##   Subject  Cond Measurement  Rating IsRecall GameNumber Confrontational… Emotion
##     <dbl> <dbl> <chr>         <dbl> <lgl>         <dbl> <lgl>            <chr>  
## 1       1     2 Game1Angry1       6 FALSE             1 TRUE             Angry  
## 2       1     2 Game1Angry2       6 FALSE             1 TRUE             Angry  
## 3       1     2 Game1Angry3       5 FALSE             1 TRUE             Angry  
## 4       1     2 Game1AngryF…      2 TRUE              1 TRUE             Angry  
## 5       1     2 Game1AngryS…      5 TRUE              1 TRUE             Angry  
## 6       1     2 Game1CalmFr…      2 TRUE              1 TRUE             Neutral

Groups, Summaries, and Results

Performance Hypothesis

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
## `summarise()` ungrouping output (override with `.groups` argument)
## # A tibble: 2 x 2
##   ConfrontationalGame AvgScore
##   <lgl>                  <dbl>
## 1 FALSE                 5288. 
## 2 TRUE                    18.3
head(performance_hyp_long_d)
## # A tibble: 6 x 7
##   Subject  Cond Measurement      Score Confrontational… WithMusic MusicCondition
##     <dbl> <dbl> <chr>            <dbl> <lgl>            <lgl>     <fct>         
## 1       1     2 DinerDashWithMu…  5830 FALSE            TRUE      Exciting      
## 2       1     2 DinerDashWithou…  5000 FALSE            FALSE     Exciting      
## 3       1     2 SOFMusicEnemies     19 TRUE             TRUE      Exciting      
## 4       1     2 SOFNoMusicEnemi…    22 TRUE             FALSE     Exciting      
## 5       3     1 DinerDashWithMu…  5370 FALSE            TRUE      Anger         
## 6       3     1 DinerDashWithou…  1250 FALSE            FALSE     Anger

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()

Rating Hypothesis

The rating hypothesis analysis also requires some grouped manipulation. The experimenters collected repeated measures on ratings in each emotion category and each music/recall category from each game. For this analysis, they averaged all the ratings over the following two variables: the given emotion and the game type, 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_summary_d = rating_hyp_long_d %>% 
  group_by(ConfrontationalGame, Emotion)%>%   ## your code here
 summarize(MeanRating = mean(Rating, na.rm=T))
## `summarise()` regrouping output by 'ConfrontationalGame' (override with `.groups` argument)
head(rating_summary_d)
## # A tibble: 6 x 3
## # Groups:   ConfrontationalGame [2]
##   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

Let’s take a look at the result:

rating_summary_d
## # A tibble: 6 x 3
## # Groups:   ConfrontationalGame [2]
##   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 Pr(>|t|)
## (Intercept)                              2.71702    0.07965  34.114   <2e-16
## ConfrontationalGameTRUE                  1.96170    0.11264  17.416   <2e-16
## EmotionExciting                          1.25319    0.11264  11.126   <2e-16
## EmotionNeutral                           0.96596    0.11264   8.576   <2e-16
## ConfrontationalGameTRUE:EmotionExciting -2.88511    0.15929 -18.112   <2e-16
## ConfrontationalGameTRUE:EmotionNeutral  -3.48936    0.15929 -21.905   <2e-16
##                                            
## (Intercept)                             ***
## ConfrontationalGameTRUE                 ***
## EmotionExciting                         ***
## EmotionNeutral                          ***
## ConfrontationalGameTRUE:EmotionExciting ***
## ConfrontationalGameTRUE:EmotionNeutral  ***
## ---
## 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

Performance Hypothesis (Continued)

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 %>%
  group_by(ConfrontationalGame, MusicCondition) %>%## Your code here
  summarize(MeanImprovementScore = mean(ImprovementScore,na.rm=T), SEM = std.error(ImprovementScore), .groups='drop')

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 4
##   ConfrontationalGame MusicCondition MeanImprovementScore   SEM
##   <lgl>               <fct>                         <dbl> <dbl>
## 1 FALSE               Anger                       -0.179  0.253
## 2 FALSE               Exciting                    -0.0182 0.143
## 3 FALSE               Neutral                      0.114  0.161
## 4 TRUE                Anger                        0.0612 0.179
## 5 TRUE                Exciting                     0.169  0.185
## 6 TRUE                Neutral                     -0.225  0.192

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") +
  geom_errorbar(aes(ymin=MeanImprovementScore-SEM, ymax=MeanImprovementScore+SEM), width=.2,
                 position=position_dodge(.9)) 

(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