if (!require(haven)){
install.packages("haven", dependencies = TRUE)
require(haven)
}Loading required package: haven
if (!require(haven)){
install.packages("haven", dependencies = TRUE)
require(haven)
}Loading required package: haven
if (!require(tidyverse)){
install.packages("tidyverse", dependencies = TRUE)
require(tidyverse)
}Loading required package: tidyverse
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.2 ✔ readr 2.1.4
✔ forcats 1.0.0 ✔ stringr 1.5.0
✔ ggplot2 3.4.2 ✔ tibble 3.2.1
✔ lubridate 1.9.2 ✔ tidyr 1.3.0
✔ purrr 1.0.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
if (!require(afex)){
install.packages("afex", dependencies = TRUE)
require(afex)
}Loading required package: afex
Loading required package: lme4
Loading required package: Matrix
Attaching package: 'Matrix'
The following objects are masked from 'package:tidyr':
expand, pack, unpack
************
Welcome to afex. For support visit: http://afex.singmann.science/
- Functions for ANOVAs: aov_car(), aov_ez(), and aov_4()
- Methods for calculating p-values with mixed(): 'S', 'KR', 'LRT', and 'PB'
- 'afex_aov' and 'mixed' objects can be passed to emmeans() for follow-up tests
- Get and set global package options with: afex_options()
- Set sum-to-zero contrasts globally: set_sum_contrasts()
- For example analyses see: browseVignettes("afex")
************
Attaching package: 'afex'
The following object is masked from 'package:lme4':
lmer
if (!require(summarytools)){
install.packages("summarytools", dependencies = TRUE)
require(summarytools)
}Loading required package: summarytools
Warning in fun(libname, pkgname): couldn't connect to display ":0"
system might not have X11 capabilities; in case of errors when using dfSummary(), set st_options(use.x11 = FALSE)
Attaching package: 'summarytools'
The following object is masked from 'package:tibble':
view
datasets <- read_sav("Group4data.sav")datasets # A tibble: 500 × 36
StartDate EndDate Status IPAddress Progress
<dttm> <dttm> <dbl+lbl> <chr> <dbl>
1 2023-08-04 16:43:37 2023-08-04 16:43:37 2 [Survey Test] "" 100
2 2023-08-04 16:43:37 2023-08-04 16:43:37 2 [Survey Test] "" 100
3 2023-08-04 16:43:37 2023-08-04 16:43:37 2 [Survey Test] "" 100
4 2023-08-04 16:43:38 2023-08-04 16:43:38 2 [Survey Test] "" 100
5 2023-08-04 16:43:38 2023-08-04 16:43:38 2 [Survey Test] "" 100
6 2023-08-04 16:43:38 2023-08-04 16:43:38 2 [Survey Test] "" 100
7 2023-08-04 16:43:38 2023-08-04 16:43:38 2 [Survey Test] "" 100
8 2023-08-04 16:43:39 2023-08-04 16:43:39 2 [Survey Test] "" 100
9 2023-08-04 16:43:39 2023-08-04 16:43:39 2 [Survey Test] "" 100
10 2023-08-04 16:43:39 2023-08-04 16:43:39 2 [Survey Test] "" 100
# ℹ 490 more rows
# ℹ 31 more variables: Duration__in_seconds_ <dbl>, Finished <dbl+lbl>,
# RecordedDate <dttm>, ResponseId <chr>, RecipientLastName <chr>,
# RecipientFirstName <chr>, RecipientEmail <chr>, ExternalReference <chr>,
# LocationLatitude <chr>, LocationLongitude <chr>, DistributionChannel <chr>,
# UserLanguage <chr>, Q2 <dbl+lbl>, tender_feelings <dbl+lbl>,
# don_t_feel_sorry <dbl+lbl>, taken_advantage_of <dbl+lbl>, …
print(dfSummary(datasets, graph.magnif = .75), method = 'render')Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
Warning in png(png_loc <- tempfile(fileext = ".png"), width = 150 *
graph.magnif, : unable to open connection to X11 display ''
| No | Variable | Label | Stats / Values | Freqs (% of Valid) | Graph | Valid | Missing | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | StartDate [POSIXct, POSIXt] | Start Date |
|
167 distinct values | 500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | EndDate [POSIXct, POSIXt] | End Date |
|
168 distinct values | 500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | Status [haven_labelled, vctrs_vctr, double] | Response Type | 1 distinct value |
|
500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | IPAddress [character] | IP Address |
|
500 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | Progress [numeric] | Progress | 1 distinct value |
|
500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | Duration__in_seconds_ [numeric] | Duration (in seconds) |
|
|
500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | Finished [haven_labelled, vctrs_vctr, double] | Finished | 1 distinct value |
|
500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | RecordedDate [POSIXct, POSIXt] | Recorded Date |
|
170 distinct values | 500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ResponseId [character] | Response ID |
|
|
500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | RecipientLastName [character] | Recipient Last Name |
|
500 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | RecipientFirstName [character] | Recipient First Name |
|
500 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | RecipientEmail [character] | Recipient Email |
|
500 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | ExternalReference [character] | External Data Reference |
|
500 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | LocationLatitude [character] | Location Latitude |
|
500 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | LocationLongitude [character] | Location Longitude |
|
500 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | DistributionChannel [character] | Distribution Channel | 1. test |
|
500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | UserLanguage [character] | User Language |
|
500 (100.0%) | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | Q2 [haven_labelled, vctrs_vctr, double] | I ATTEST THAT I AM AT LEAST 18 YEARS OLD. I HAVE HAD THE OPPORTUNITY TO READ THIS CONSENT FORM, ASK QUESTIONS ABOUT THE RESEARCH STUDY & I AM PREPARED TO PARTICIPATE IN THIS STUDY. |
|
|
500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | tender_feelings [haven_labelled, vctrs_vctr, double] | I often have tender, concerned feelings for people less fortunate than me. |
|
|
239 (47.8%) | 261 (52.2%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | don_t_feel_sorry [haven_labelled, vctrs_vctr, double] | Sometimes I don't feel very sorry for other people when they are having problems. |
|
|
239 (47.8%) | 261 (52.2%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | taken_advantage_of [haven_labelled, vctrs_vctr, double] | When I see someone being taken advantage of, I feel kind of protective towards them. |
|
|
239 (47.8%) | 261 (52.2%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | misfortunes_of_other [haven_labelled, vctrs_vctr, double] | Other people's misfortunes do not usually disturb me a great deal. |
|
|
239 (47.8%) | 261 (52.2%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | pity [haven_labelled, vctrs_vctr, double] | When I see someone being treated unfairly, I sometimes don't feel very much pity for them. |
|
|
239 (47.8%) | 261 (52.2%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | touched [haven_labelled, vctrs_vctr, double] | I am often quite touched by things that I see happen. |
|
|
239 (47.8%) | 261 (52.2%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | soft_hearted [haven_labelled, vctrs_vctr, double] | I would describe myself as a pretty soft-hearted person. |
|
|
239 (47.8%) | 261 (52.2%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | gender [character] | Please specify your gender. |
|
|
500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | race [character] | Please specify your race or ethnic background. |
|
|
500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | age_4 [numeric] | Please enter your age (must be a number that is at least 18) - Age |
|
78 distinct values | 239 (47.8%) | 261 (52.2%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | hypothesis [character] | What did you think the hypothesis of this study were? |
|
|
500 (100.0%) | 0 (0.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | FL_17_DO_Condition1__PositiveExposureandImage [numeric] | FL_17 - Block Randomizer - Display Order Condition1: PositiveExposureandImage | 1 distinct value |
|
60 (12.0%) | 440 (88.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | FL_17_DO_Condition2_PositiveExposureandNoImage [numeric] | FL_17 - Block Randomizer - Display Order Condition2:PositiveExposureandNoImage | 1 distinct value |
|
60 (12.0%) | 440 (88.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | FL_17_DO_Condition3_NegativeExposureandImage [numeric] | FL_17 - Block Randomizer - Display Order Condition3:NegativeExposureandImage | 1 distinct value |
|
59 (11.8%) | 441 (88.2%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | FL_17_DO_Condition4_NegativeExposureandNoImage [numeric] | FL_17 - Block Randomizer - Display Order Condition4:NegativeExposureandNoImage | 1 distinct value |
|
60 (12.0%) | 440 (88.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | Condition1__PositiveExposureandImage_DO_Q3 [numeric] | Condition 1: Positive Exposure and Image - Display Order Q3 | 1 distinct value |
|
60 (12.0%) | 440 (88.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | Condition2_PositiveExposureandNoImage_DO_Q12 [numeric] | Condition 2: Positive Exposure and No Image - Display Order Q12 | 1 distinct value |
|
60 (12.0%) | 440 (88.0%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | Condition4_NegativeExposureandNoImage_DO_Q30 [numeric] | Condition 4: Negative Exposure and No Image - Display Order Q30 | 1 distinct value |
|
60 (12.0%) | 440 (88.0%) |
Generated by summarytools 1.0.1 (R version 4.3.1)
2023-08-05
datasets %>%
mutate(MoodValenceIV = case_when(FL_17_DO_Condition1__PositiveExposureandImage == 1 ~ "Positive", FL_17_DO_Condition2_PositiveExposureandNoImage == 1 ~ "Positive", FL_17_DO_Condition3_NegativeExposureandImage == 1 ~ "Negative", FL_17_DO_Condition4_NegativeExposureandNoImage == 1 ~ "Negative")) -> datasetsdatasets %>%
mutate(ImageIV = case_when(FL_17_DO_Condition1__PositiveExposureandImage == 1 ~ "Image", FL_17_DO_Condition2_PositiveExposureandNoImage == 1 ~ "None", FL_17_DO_Condition3_NegativeExposureandImage == 1 ~ "Image",FL_17_DO_Condition4_NegativeExposureandNoImage == 1 ~ "None")) -> datasets datasets %>%
mutate(feelingsDV = as.numeric(tender_feelings)) -> datasetsaov_ez(id = "ResponseId",
dv = "feelingsDV",
data = datasets,
between=c('MoodValenceIV', "ImageIV"),
anova_table = list(es = "pes"))Converting to factor: MoodValenceIV, ImageIV
Warning: Missing values for 261 ID(s), which were removed before analysis:
R_064ON7LdeDHpA6W, R_07Bmuf9KvloM4JM, R_07JdVcansioR5cO, R_080M1NYB7Zvji8m, R_088ZsbHZh3vWNx4, R_09glXsS5d2Bcv9I, R_0BZmUo4KxR4Dgma, R_0c6552agj5znstU, R_0cxz5sRzAHsdPZY, R_0f8WhTlww5YfmKy, ... [showing first 10 only]
Below the first few rows (in wide format) of the removed cases with missing data.
ResponseId MoodValenceIV ImageIV .
# 4 R_064ON7LdeDHpA6W <NA> <NA> NA
# 6 R_07Bmuf9KvloM4JM <NA> <NA> NA
# 7 R_07JdVcansioR5cO <NA> <NA> NA
# 8 R_080M1NYB7Zvji8m <NA> <NA> NA
# 9 R_088ZsbHZh3vWNx4 <NA> <NA> NA
# 12 R_09glXsS5d2Bcv9I <NA> <NA> NA
Contrasts set to contr.sum for the following variables: MoodValenceIV, ImageIV
Anova Table (Type 3 tests)
Response: feelingsDV
Effect df MSE F pes p.value
1 MoodValenceIV 1, 235 2.04 2.82 + .012 .095
2 ImageIV 1, 235 2.04 0.05 <.001 .828
3 MoodValenceIV:ImageIV 1, 235 2.04 0.05 <.001 .815
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
datasets %>%
group_by(ImageIV) %>%
summarise(mean = mean(feelingsDV),
sd = sd(feelingsDV))# A tibble: 3 × 3
ImageIV mean sd
<chr> <dbl> <dbl>
1 Image 2.01 1.34
2 None 2.05 1.52
3 <NA> NA NA
datasets %>%
group_by(MoodValenceIV) %>%
summarise(mean = mean(feelingsDV),
sd = sd(feelingsDV))# A tibble: 3 × 3
MoodValenceIV mean sd
<chr> <dbl> <dbl>
1 Negative 2.18 1.42
2 Positive 1.88 1.42
3 <NA> NA NA
datasets %>%
group_by(ImageIV, MoodValenceIV) %>%
summarise(mean = mean(feelingsDV),
sd = sd(feelingsDV))`summarise()` has grouped output by 'ImageIV'. You can override using the
`.groups` argument.
# A tibble: 5 × 4
# Groups: ImageIV [3]
ImageIV MoodValenceIV mean sd
<chr> <chr> <dbl> <dbl>
1 Image Negative 2.19 1.36
2 Image Positive 1.83 1.30
3 None Negative 2.18 1.49
4 None Positive 1.92 1.54
5 <NA> <NA> NA NA