setwd("~/Google Drive/work/old projects/Good man effect/analysis/data")
load("cleaned_data_final.csv")

## rule out people who don't believe the setting
check = c("computer", "fake","real", "bot")
d <- subset(temp, grepl(paste(check, collapse= "|"), temp$things_unusual))
data = temp[!temp$MTurk_ID %in% d$MTurk_ID, ]
rm(d)

moderator_temp = data[, c(3,50:62)]

moderator_temp <- data.frame(moderator_temp[, c(1,8:14)], stack(moderator_temp[2:7]))
## Warning in data.frame(moderator_temp[, c(1, 8:14)],
## stack(moderator_temp[2:7])): row names were found from a short variable and
## have been discarded
names(moderator_temp)[10] = "condition"
names(moderator_temp)[9] = "accept"

## set condition variables
## good vs. bad
moderator_temp$good[moderator_temp$condition=="accept_good_average"|moderator_temp$condition=="accept_good_fair"|moderator_temp$condition=="accept_good_selfish"] =1
moderator_temp$good[moderator_temp$condition=="accept_bad_average"|moderator_temp$condition=="accept_bad_fair"|moderator_temp$condition=="accept_bad_selfish"] =0

moderator_temp$average[moderator_temp$condition=="accept_good_average"|moderator_temp$condition=="accept_bad_average"] =1
moderator_temp$average[moderator_temp$condition !="accept_good_average" & moderator_temp$condition !="accept_bad_average"] =0


moderator_temp$fair[moderator_temp$condition=="accept_good_fair"|moderator_temp$condition=="accept_bad_fair"] =1
moderator_temp$fair[moderator_temp$condition !="accept_good_fair" & moderator_temp$condition !="accept_bad_fair"] =0

moderator_temp$selfish[moderator_temp$condition=="accept_good_selfish"|moderator_temp$condition=="accept_bad_selfish"] =1
moderator_temp$selfish[moderator_temp$condition !="accept_good_selfish" & moderator_temp$condition !="accept_bad_selfish"] =0

You can also embed plots, for example:

## 
## Call:
## glm(formula = accept ~ moral_internalization, family = binomial, 
##     data = bad_reputation)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4791  -1.4697   0.9087   0.9109   0.9242  
## 
## Coefficients:
##                       Estimate Std. Error z value Pr(>|z|)
## (Intercept)            0.73344    0.72283   1.015    0.310
## moral_internalization -0.01484    0.16191  -0.092    0.927
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 751.8  on 586  degrees of freedom
## Residual deviance: 751.8  on 585  degrees of freedom
##   (22 observations deleted due to missingness)
## AIC: 755.8
## 
## Number of Fisher Scoring iterations: 4
## 
## Call:
## glm(formula = accept ~ (fair + selfish), family = binomial, data = bad_reputation)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.0282  -0.9394   0.1432   0.9341   1.4357  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   0.6035     0.1487   4.060 4.91e-05 ***
## fair          3.9712     0.7261   5.469 4.52e-08 ***
## selfish      -1.1929     0.2098  -5.687 1.29e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 758.10  on 592  degrees of freedom
## Residual deviance: 538.88  on 590  degrees of freedom
##   (16 observations deleted due to missingness)
## AIC: 544.88
## 
## Number of Fisher Scoring iterations: 7
## 
## Call:
## glm(formula = accept ~ moral_internalization * (fair + selfish), 
##     family = binomial, data = bad_reputation)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.0646  -0.9227   0.1355   0.9306   1.4955  
## 
## Coefficients:
##                               Estimate Std. Error z value Pr(>|z|)
## (Intercept)                    0.98027    1.23137   0.796    0.426
## moral_internalization         -0.08354    0.27561  -0.303    0.762
## fair                           7.04375    5.10496   1.380    0.168
## selfish                       -1.79140    1.74386  -1.027    0.304
## moral_internalization:fair    -0.67495    1.08047  -0.625    0.532
## moral_internalization:selfish  0.12387    0.39047   0.317    0.751
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 751.80  on 586  degrees of freedom
## Residual deviance: 529.09  on 581  degrees of freedom
##   (22 observations deleted due to missingness)
## AIC: 541.09
## 
## Number of Fisher Scoring iterations: 7
## 
## Call:
## glm(formula = accept ~ moral_internalization * (fair + average), 
##     family = binomial, data = bad_reputation)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.0646  -0.9227   0.1355   0.9306   1.4955  
## 
## Coefficients:
##                               Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                   -0.81113    1.23482  -0.657   0.5113  
## moral_internalization          0.04032    0.27660   0.146   0.8841  
## fair                           8.83515    5.10580   1.730   0.0836 .
## average                        1.79140    1.74386   1.027   0.3043  
## moral_internalization:fair    -0.79882    1.08072  -0.739   0.4598  
## moral_internalization:average -0.12387    0.39047  -0.317   0.7511  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 751.80  on 586  degrees of freedom
## Residual deviance: 529.09  on 581  degrees of freedom
##   (22 observations deleted due to missingness)
## AIC: 541.09
## 
## Number of Fisher Scoring iterations: 7
## 
## Call:
## glm(formula = accept ~ moral_symbolization, family = binomial, 
##     data = bad_reputation)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.5477  -1.4511   0.8960   0.9187   0.9615  
## 
## Coefficients:
##                     Estimate Std. Error z value Pr(>|z|)   
## (Intercept)          0.88942    0.30402   2.926  0.00344 **
## moral_symbolization -0.05109    0.06688  -0.764  0.44495   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 751.80  on 586  degrees of freedom
## Residual deviance: 751.22  on 585  degrees of freedom
##   (22 observations deleted due to missingness)
## AIC: 755.22
## 
## Number of Fisher Scoring iterations: 4
## 
## Call:
## glm(formula = accept ~ moral_symbolization * (fair + selfish), 
##     family = binomial, data = bad_reputation)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.0505  -0.8950   0.1417   0.9307   1.5943  
## 
## Coefficients:
##                             Estimate Std. Error z value Pr(>|z|)
## (Intercept)                  0.69327    0.51405   1.349    0.177
## moral_symbolization         -0.01924    0.11359  -0.169    0.866
## fair                         3.53781    2.39847   1.475    0.140
## selfish                     -0.70055    0.72010  -0.973    0.331
## moral_symbolization:fair     0.09851    0.54331   0.181    0.856
## moral_symbolization:selfish -0.12675    0.16042  -0.790    0.429
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 751.80  on 586  degrees of freedom
## Residual deviance: 527.92  on 581  degrees of freedom
##   (22 observations deleted due to missingness)
## AIC: 539.92
## 
## Number of Fisher Scoring iterations: 7
## 
## Call:
## glm(formula = accept ~ moral_symbolization * (fair + average), 
##     family = binomial, data = bad_reputation)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.0505  -0.8950   0.1417   0.9307   1.5943  
## 
## Coefficients:
##                              Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                 -0.007277   0.504276  -0.014    0.988  
## moral_symbolization         -0.145992   0.113280  -1.289    0.197  
## fair                         4.238359   2.396392   1.769    0.077 .
## average                      0.700551   0.720095   0.973    0.331  
## moral_symbolization:fair     0.225263   0.543249   0.415    0.678  
## moral_symbolization:average  0.126755   0.160422   0.790    0.429  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 751.80  on 586  degrees of freedom
## Residual deviance: 527.92  on 581  degrees of freedom
##   (22 observations deleted due to missingness)
## AIC: 539.92
## 
## Number of Fisher Scoring iterations: 7

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.