Loading relevant packages
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.1.2 v dplyr 1.0.6
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(janitor)
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(dplyr)
Loading data
library(remotes)
install_github("JanMarvin/readspss")
## Skipping install of 'readspss' from a github remote, the SHA1 (bbc71e6b) has not changed since last install.
## Use `force = TRUE` to force installation
library(readr)
replicationdata <- read_csv("~/Coding-R/replication project/replicationdata.csv")
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## ParticipantID = col_character(),
## General_1_MedList = col_character(),
## General_1_University = col_character()
## )
## i Use `spec()` for the full column specifications.
cleandata <- replicationdata %>% # removing participants who were excluded
filter(exclude==0)
ageaverage <- cleandata %>% #calculating average age including sd using cleaned data
select(General_1_Age) %>%
summarise(ageaverage = mean(General_1_Age),
agesd = sd(General_1_Age))
print(ageaverage)
## # A tibble: 1 x 2
## ageaverage agesd
## <dbl> <dbl>
## 1 19.5 1.23
ESS <- cleandata %>%
select(Epworth_total) %>%
summarise(ESS = mean(Epworth_total), ESSSD = sd(Epworth_total))
print(ESS)
## # A tibble: 1 x 2
## ESS ESSSD
## <dbl> <dbl>
## 1 15.3 2.83
SSSgroup <- cleandata %>%
select(AlertTest_1_Feel,
AlertTest_2_Feel,
AlertTest_3_Feel,
AlertTest_4_Feel) %>%
drop_na() %>%
summarise(
AT1F = mean(AlertTest_1_Feel),
AT2F = mean(AlertTest_2_Feel),
AT3F = mean(AlertTest_3_Feel),
AT4F = mean(AlertTest_4_Feel)
)
SSS <- SSSgroup %>%
summarise(SSSav = mean(SSSgroup))
## Warning in mean.default(SSSgroup): argument is not numeric or logical: returning
## NA
print(SSS)
## # A tibble: 1 x 1
## SSSav
## <dbl>
## 1 NA
SSStotal <- cleandata %>%
select(AlertTest_1_Feel,
AlertTest_2_Feel,
AlertTest_3_Feel,
AlertTest_4_Feel) %>%
merge(AlertTest_1_Feel, AlertTest_2_Feel, AlertTest_3_Feel, AlertTest_4_Feel, by=participantID)
print(SSStotal)
SSS <- cleandata %>%
select(AlertTest_1_Feel,
AlertTest_2_Feel,
AlertTest_3_Feel,
AlertTest_4_Feel) %>%
drop_na() %>%
summarise( mean( rbind(AlertTest_1_Feel, AlertTest_2_Feel, AlertTest_3_Feel, AlertTest_4_Feel)))
print(SSS)
## # A tibble: 1 x 1
## `mean(...)`
## <dbl>
## 1 2.69
SSStrial <- replicationdata %>%
select(AlertTest_1_Feel,
AlertTest_2_Feel,
AlertTest_3_Feel,
AlertTest_4_Feel) %>%
drop_na() %>%
summarise( mean( rbind(AlertTest_1_Feel, AlertTest_2_Feel, AlertTest_3_Feel, AlertTest_4_Feel)))
print(SSStrial)
## # A tibble: 1 x 1
## `mean(...)`
## <dbl>
## 1 2.62
SSS <- cleandata %>%
select(AlertTest_1_Feel) %>%
summarise(SSSmean = mean(AlertTest_1_Feel), SSSsd = sd(AlertTest_1_Feel))
print(SSS)
## # A tibble: 1 x 2
## SSSmean SSSsd
## <dbl> <dbl>
## 1 2.81 0.749
BIB <- cleandata %>%
select(
base_IAT_race,
base_IAT_gen) %>%
summarise(BIBav = mean(rbind(base_IAT_race, base_IAT_gen)), BIBsd = sd(rbind(base_IAT_race, base_IAT_gen)))
print(BIB)
## # A tibble: 1 x 2
## BIBav BIBsd
## <dbl> <dbl>
## 1 0.557 0.406
PrenapIB <- cleandata %>%
select(
pre_IAT_race,
pre_IAT_gen) %>%
summarise(PrenapIBav = mean(rbind(pre_IAT_race, pre_IAT_gen)), PrenapIBsd = sd(rbind(pre_IAT_race, pre_IAT_gen)))
print(PrenapIB)
## # A tibble: 1 x 2
## PrenapIBav PrenapIBsd
## <dbl> <dbl>
## 1 0.257 0.478
PostnapIB <- cleandata %>%
select(
post_IAT_race,
post_IAT_gen) %>%
summarise(
PostnapIBav = mean(rbind(post_IAT_race, post_IAT_gen)),
PostnapIBsd = sd(rbind(post_IAT_race, post_IAT_gen)))
print(PostnapIB)
## # A tibble: 1 x 2
## PostnapIBav PostnapIBsd
## <dbl> <dbl>
## 1 0.278 0.459
OWDIB <- cleandata %>%
select(
week_IAT_race,
week_IAT_gen) %>%
summarise(
OWDIBav = mean(rbind(week_IAT_gen, week_IAT_gen)),
OWDIBsd = sd(rbind(week_IAT_gen, week_IAT_gen))
)
print(OWDIB)
## # A tibble: 1 x 2
## OWDIBav OWDIBsd
## <dbl> <dbl>
## 1 0.384 0.402
# note: numbers are close but not exact even when rounded ???
Male <- cleandata %>%
select(General_1_Sex) %>%
tally(General_1_Sex == 1)
Male_percentage <- Male/31 #31 as the clean data set has 31 participants
print(Male_percentage)
## n
## 1 0.483871
NapCue <- cleandata %>%
select(Cue_condition) %>%
tally(Cue_condition == 1)
NapCue_percentage <- NapCue/31
print(NapCue_percentage)
## n
## 1 0.5483871