Preliminaries: Load 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(dplyr)
library(tibble)
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
Load data
cleandata <- read.csv("cleandata.csv")
(apologies in advance for the crazy formatting of my learning logs)
Following on from last week, the reason why some of my values were not the same was due to small typos, where I binded the same variable instead of binding two different variables. That was an easy fix :)
In our first meeting we aimed to figure out how to format our tables better. Table 1 looked great and was quite accurate to the original.
However, table 2 was a bit more complicated.
An image of table two is below:
Our group tends to do a divide and conquer, but rejoin and conquer even more approach (haha). We split off and attempt the code, and when we find something useful we report back to the group to save the others time from trying to find the same thing somebody already has.
Julia was able to condense our code, so instead of have numerous chunks to calculate descriptive statistics for each variable, we could do it all in one nice chunk:
implicitbiaslevels <- cleandata %>%
select(base_IAT_race, base_IAT_gen, pre_IAT_race, pre_IAT_gen)
# Selecting the relevant variables for the table
implicitbiaslevels %>%
summarise(across(contains("IAT"), list(mean = mean, sd = sd)))
## base_IAT_race_mean base_IAT_race_sd base_IAT_gen_mean base_IAT_gen_sd
## 1 0.6186929 0.4423884 0.4943818 0.36228
## pre_IAT_race_mean pre_IAT_race_sd pre_IAT_gen_mean pre_IAT_gen_sd
## 1 0.2023364 0.5633004 0.3109984 0.3748071
#filtering the data, so that R will calculate the mean and Sd of variables that include IAT i.e. all of our relevant variables
write_csv(implicitbiaslevels, path = "implicitbiaslevels.csv")
## Warning: The `path` argument of `write_csv()` is deprecated as of readr 1.4.0.
## Please use the `file` argument instead.
# Here we created a new data file for table 2
library(readr)
implicitbiaslevels <- read_csv("~/Coding-R/replication project/implicitbiaslevels.csv")
##
## -- Column specification --------------------------------------------------------
## cols(
## base_IAT_race = col_double(),
## base_IAT_gen = col_double(),
## pre_IAT_race = col_double(),
## pre_IAT_gen = col_double()
## )
This is compared to my original method, following from last weeks knowledge:
Calculating mean (and SD) baseline Race bias
BaselineRace <- cleandata %>%
select(base_IAT_race) %>% #selecting relevant variable
summarise(BaselineRaceMean = mean(base_IAT_race), BaselineRaceSD = sd(base_IAT_race)) #calculate mean and SD
print(BaselineRace)
## BaselineRaceMean BaselineRaceSD
## 1 0.6186929 0.4423884
Calculating mean (and SD) baseline gender bias
BaselineGender <- cleandata %>%
select(base_IAT_gen) %>%
summarise(BaselineGenderMean = mean(base_IAT_gen), BaselineGenderSD = sd(base_IAT_gen))
print(BaselineGender)
## BaselineGenderMean BaselineGenderSD
## 1 0.4943818 0.36228
Calculating prenap race bias
PrenapRace <- cleandata %>%
select(pre_IAT_race) %>%
summarise(PrenapRaceMean = mean(pre_IAT_race), PrenapRaceSD = sd(pre_IAT_race))
print(PrenapRace)
## PrenapRaceMean PrenapRaceSD
## 1 0.2023364 0.5633004
Calculating prenap gender bias
PrenapGender <- cleandata %>%
select(pre_IAT_gen) %>%
summarise(Prenapgendermean = mean(pre_IAT_gen), PrenapRaceSD = sd(pre_IAT_gen))
print(PrenapGender)
## Prenapgendermean PrenapRaceSD
## 1 0.3109984 0.3748071
I had already given an attempt at recreating Table 2. However, there were a few differences between my table and the original. 1. the row labels, race, and gender, were in their own rows rather than being in the same rows as the numbers 2. R wouldn’t let me have multiple columns with the same name e.g. mean, therefore I had to put mean1, mean2
I decided to use the package gt to create the table as it seemed the most straightforward, and honestly easier package to use.
Load packages for table
library(knitr)
library(kableExtra)
##
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
##
## group_rows
library(gt)
To make a table in R, you need to create a tibble including the relevant data.
This was my original data tibble:
table2.0 <- tibble(
mean1 = c(0.6186929, 0.4943818),
mean2 = c(0.2023364, 0.3109984),
SD1 = c(0.4423884, 0.36228),
SD2 = c(0.5633004, 0.3748071)
)
#note, no "label" column
print(table2.0)
## # A tibble: 2 x 4
## mean1 mean2 SD1 SD2
## <dbl> <dbl> <dbl> <dbl>
## 1 0.619 0.202 0.442 0.563
## 2 0.494 0.311 0.362 0.375
You then use the gt package to format your table including labels, titles and more:
table2.0 %>%
gt() %>%
tab_header(
title = "Table 2: Race and Gender Implicit Bias Levels") %>% # inserting main title
tab_source_note("Implicit bias values are the average D600 score for each timepoint") %>% #footnotes
fmt_number(columns = vars(mean1, mean2, SD1, SD2), decimals = 2) %>% #including the relevant columns into the table, rounding values to 2dc
tab_spanner(
label = "Baseline",
columns = c(mean1, SD1)
) %>% #labelling/grouping the columns
tab_spanner(
label = "Prenap",
columns = c(mean2, SD2)
) %>%
tab_row_group(
label = "Race", #labelling the rows
rows = 1
) %>%
tab_row_group(
label = "Gender",
rows = 2
)
## Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
## * please use `columns = c(...)` instead
## Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
## * please use `columns = c(...)` instead
| Table 2: Race and Gender Implicit Bias Levels | |||
|---|---|---|---|
| Baseline | Prenap | ||
| mean1 | SD1 | mean2 | SD2 |
| Gender | |||
| 0.49 | 0.36 | 0.31 | 0.37 |
| Race | |||
| 0.62 | 0.44 | 0.20 | 0.56 |
| Implicit bias values are the average D600 score for each timepoint | |||
print(table2.0)
## # A tibble: 2 x 4
## mean1 mean2 SD1 SD2
## <dbl> <dbl> <dbl> <dbl>
## 1 0.619 0.202 0.442 0.563
## 2 0.494 0.311 0.362 0.375
Spot the difference. There are a few things not right with the table.
The meeting involved the group members attempting to troubleshoot and figure out how to create an accurate table.
We first tried to edit the tibble created by Julia’s summary chunk, but this lead to dead ends. Even google didn’t seem to help!
We decided to then enter the data manually in a new tibble and attempt editing the formatting of the table.
After some trial and error, I ended up with an exciting solution!
Firstly, in order to create a table, R needs a tibble to translate into a table. The format of the tibble is important as it is the foundation of the table, especially the columns. I discovered it is very hard to add columns after the tibble is made, and that it is much easier to edit the tibble.
In the draft table, race and gender were in a new row, which we discovered was because used the tab_row_group function, which added a group label, instead of a row label. However, when we tried to add a normal row label, we could not seem to figure it out!
I came up with a different solution.
If we added a new column in the tibble for the labels gender and race, it should appear in the proper rows:
Creating tibble:
table2 <- tibble(
label = c("race", "gender"), #NOTE!!! This was the changing poin - column for the row labels
mean1 = c(0.6186929, 0.4943818),
mean2 = c(0.2023364, 0.3109984),
SD1 = c(0.4423884, 0.36228),
SD2 = c(0.5633004, 0.3748071)
)
print(table2)
## # A tibble: 2 x 5
## label mean1 mean2 SD1 SD2
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 race 0.619 0.202 0.442 0.563
## 2 gender 0.494 0.311 0.362 0.375
Furthermore, as a group, we figured out how to rename our labels to have the same name! Using the col_label function. We also used this function to remove the label “label” and make it blank instead.
Formatting and labelling table
table2 %>%
gt() %>%
tab_header(
title = "Table 2: Race and Gender Implicit Bias Levels") %>%
tab_source_note("Implicit bias values are the average D600 score for each timepoint") %>%
fmt_number(columns = vars(mean1, mean2, SD1, SD2), decimals = 2) %>%
tab_spanner(
label = "Baseline",
columns = c(mean1, SD1) #column label baseline should only show over mean1 and sd1
) %>%
tab_spanner(
label = "Prenap",
columns = c(mean2, SD2) #column label prenap should only show over mean2 and sd2
) %>%
cols_label(mean1 = "mean", mean2 = "mean", SD1 = "SD", SD2 = "SD", label = " ") #renaming column labels. Note how we remove the label "label.
## Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
## * please use `columns = c(...)` instead
## Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
## * please use `columns = c(...)` instead
| Table 2: Race and Gender Implicit Bias Levels | ||||
|---|---|---|---|---|
| Baseline | Prenap | |||
| mean | SD | mean | SD | |
| race | 0.62 | 0.44 | 0.20 | 0.56 |
| gender | 0.49 | 0.36 | 0.31 | 0.37 |
| Implicit bias values are the average D600 score for each timepoint | ||||
print(table2)
## # A tibble: 2 x 5
## label mean1 mean2 SD1 SD2
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 race 0.619 0.202 0.442 0.563
## 2 gender 0.494 0.311 0.362 0.375
Following from our experience in calculatin descriptive stats and formatting tables, table 3 was much quicker and easier to do:
Table 3 displays implicit bias levels measured at different time points and for each condition: cued and uncued.
Using Julia’s condesed method for calculating descriptive stats, we calculated the averages using the below code:
table3 <- cleandata %>%
select(baseIATcued, baseIATuncued, preIATcued, preIATuncued, postIATcued, postIATuncued, weekIATcued, weekIATuncued) #select relevant variables
table3 <- table3 %>%
summarise(across(contains("IAT"), list(mean = mean, sd = sd))) #calculating descriptives
table3 <- table3 %>%
mutate(across(
1:16, round, 2)) #rounding to 2 decimal points
print(table3)
## baseIATcued_mean baseIATcued_sd baseIATuncued_mean baseIATuncued_sd
## 1 0.52 0.36 0.6 0.45
## preIATcued_mean preIATcued_sd preIATuncued_mean preIATuncued_sd
## 1 0.21 0.51 0.3 0.44
## postIATcued_mean postIATcued_sd postIATuncued_mean postIATuncued_sd
## 1 0.31 0.44 0.25 0.48
## weekIATcued_mean weekIATcued_sd weekIATuncued_mean weekIATuncued_sd
## 1 0.4 0.39 0.4 0.47
We then created a tibble for the data to make it into a table:
table3.0 <- tibble(
Label = c("Baseline", "Prenap", "Postnap", "1-week delay"),
mean1 = c(0.52, 0.21, 0.31, 0.40),
SD1 = c(0.36, 0.51, 0.44, 0.39),
mean2 = c(0.60, 0.30, 0.25, 0.40),
SD2 = c(0.45, 0.44, 0.48, 0.47)
)
print(table3.0)
## # A tibble: 4 x 5
## Label mean1 SD1 mean2 SD2
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Baseline 0.52 0.36 0.6 0.45
## 2 Prenap 0.21 0.51 0.3 0.44
## 3 Postnap 0.31 0.44 0.25 0.48
## 4 1-week delay 0.4 0.39 0.4 0.47
Similarly to table 2, we used the package gt, to make a table, following the same principles as previous.
table3.0 %>%
gt() %>%
tab_header("Implicit bias levels by condition.") %>%
tab_source_note("Implicit bias values are the average D600 score for each timepoint") %>%
fmt_number(columns = vars(mean1, mean2, SD1, SD2)) %>%
tab_spanner(
label = "Cued",
columns = c(mean1, SD1)
) %>%
tab_spanner(
label = "Uncued",
columns = c(mean2, SD2)
) %>%
cols_label(mean1 = "mean", SD1 = "SD", mean2 = "mean", SD1 = "SD", Label = "")
## Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
## * please use `columns = c(...)` instead
## Warning: `columns = vars(...)` has been deprecated in gt 0.3.0:
## * please use `columns = c(...)` instead
| Implicit bias levels by condition. | ||||
|---|---|---|---|---|
| Cued | Uncued | |||
| mean | SD | mean | SD2 | |
| Baseline | 0.52 | 0.36 | 0.60 | 0.45 |
| Prenap | 0.21 | 0.51 | 0.30 | 0.44 |
| Postnap | 0.31 | 0.44 | 0.25 | 0.48 |
| 1-week delay | 0.40 | 0.39 | 0.40 | 0.47 |
| Implicit bias values are the average D600 score for each timepoint | ||||
In our second meeting on Thursday the group tried to delve into ggplots.
We decided to try to replicate figure 4 first as it seemed to be the easiest.
In summary, figure four uses data from table 3 to calculate differences in implicit bias based on condition and time delay. Where: - the immediate condition = postnap-prenap - week delay = 1-week delay - Prenap
Originally We manually created a tibble for the data for figure four:
pre_post_change_cued = 0.31 - 0.21
pre_post_change_uncued = 0.25 - 0.3
pre_week_change_cued = 0.40 - 0.21
pre_week_change_uncued = 0.40 - 0.30
fig4 <- tibble(
change_from_pre_to = c("immediate","week"),
cued = c(0.1, 0.19),
uncued = c(-0.05, 0.1))
print(fig4)
## # A tibble: 2 x 3
## change_from_pre_to cued uncued
## <chr> <dbl> <dbl>
## 1 immediate 0.1 -0.05
## 2 week 0.19 0.1
However following the Thursday classes I tried to find a way to manipulate the existing data to calculate the changes in implicit bias, and potentially use this to calculate standard deviations needed for the error bars in the plot.
I started by mutating the data to form two new variables/columns for immediate and one week delay. I created my own tibble for the data from table 3 where the data is orgnaised by cue condition, and only uses the means (ignores the SD calculated previously)
table3.1 <- tibble(
statistics = c("mean1", "mean2"),
Baseline = c(0.52, 0.60),
Prenap = c(0.21, 0.30),
Postnap = c(0.31, 0.25),
Week = c(0.40, 0.40)
)
print(table3.1)
## # A tibble: 2 x 5
## statistics Baseline Prenap Postnap Week
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 mean1 0.52 0.21 0.31 0.4
## 2 mean2 0.6 0.3 0.25 0.4
I then indicated to R I wanted a new column labelled “week” which would equal the data of week - prenap. Then repeated this method for the immediate group.
If you look at the tibble, you will see the calculated differences in implicit bias under the “week” and “immediate” columns. Note how I calculated all the differences in one smaller chunk of code compared to manually calculating them.
I’m not sure if this calcualted the sd’s properly but used the describe function from the psych package to calculate the standard deviations of the new variables “week” and “immediate”, being 0.06 and 0.11 respectively.
table3.2 <- table3.1 %>%
mutate(week = Week - Prenap) %>%
mutate(immediate = Postnap- Prenap)
print(table3.2)
## # A tibble: 2 x 7
## statistics Baseline Prenap Postnap Week week immediate
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 mean1 0.52 0.21 0.31 0.4 0.19 0.1
## 2 mean2 0.6 0.3 0.25 0.4 0.1 -0.05
describe(table3.2)
## vars n mean sd median trimmed mad min max range skew kurtosis
## statistics* 1 2 1.50 0.71 1.50 1.50 0.74 1.00 2.00 1.00 0 -2.75
## Baseline 2 2 0.56 0.06 0.56 0.56 0.06 0.52 0.60 0.08 0 -2.75
## Prenap 3 2 0.26 0.06 0.26 0.26 0.07 0.21 0.30 0.09 0 -2.75
## Postnap 4 2 0.28 0.04 0.28 0.28 0.04 0.25 0.31 0.06 0 -2.75
## Week 5 2 0.40 0.00 0.40 0.40 0.00 0.40 0.40 0.00 NaN NaN
## week 6 2 0.15 0.06 0.15 0.15 0.07 0.10 0.19 0.09 0 -2.75
## immediate 7 2 0.03 0.11 0.03 0.03 0.11 -0.05 0.10 0.15 0 -2.75
## se
## statistics* 0.50
## Baseline 0.04
## Prenap 0.04
## Postnap 0.03
## Week 0.00
## week 0.04
## immediate 0.07
I then made a new data set with Sd using the past calculations.
time1 <- c(rep("immediate",2),rep("week",2))
condition <-rep(c("cued","uncued"),2)
bias_change <- c(0.10, -0.05, 0.19, 0.10)
sd <- c(0.11, 0.11, 0.06, 0.06)
data1 = data.frame(time1, condition, bias_change, sd)
head(data1)
## time1 condition bias_change sd
## 1 immediate cued 0.10 0.11
## 2 immediate uncued -0.05 0.11
## 3 week cued 0.19 0.06
## 4 week uncued 0.10 0.06
I then used the data to form a basic plot.
aes() function indicates the aesthetics of the plot including what the x and y axis are, and how I want to colour the graph, which I indicated to colour the graph by condition.geom_bar indicates to R that I want to make a bar graph, with the conditions positioned seapartely, hence dodgegeom_bar, R, reads the data differently compared to geom_col, where they use the group average of your data to plot the heights of the bars, rather than your inputted data. This is why you need to put stat = “identity”ggplot(data = data1, aes(
x = time1,
y = bias_change,
fill = condition
)) +
geom_bar(position = "dodge", stat = "identity", alpha=0.7)
Now we have a plot similar to figure 4! Except there are no error bars!
To add error bars you need to use the function geom_errorbar where:
ggplot(data = data1, aes(
x = time1,
y = bias_change,
fill = condition
)) +
geom_bar(position = "dodge", stat = "identity", alpha=0.7) +
geom_errorbar(aes(
x= time1,
ymin=bias_change-sd,
ymax=bias_change+sd),
width=0.4, colour="grey", alpha= 0.9) +
ylim(-0.2, 0.4) #where the y axis cuts off
Although I was on a roll, my error bars weren’t sitting in the right spot!
After more googling I discovered it was due to positioning.
I needed to add where to position the bars which needed to be position = position_dodge()
I also added ylim to control where the Y axis on my plot cuts off.
#plot
ggplot(data = data1, aes(
x = time1,
y = bias_change,
fill = condition
)) +
geom_bar(position = "dodge", stat = "identity", alpha=0.7) +
geom_errorbar(aes(
x= time1,
ymin=bias_change-sd,
ymax=bias_change+sd),
width=0.4, colour="grey", alpha= 0.9, position = position_dodge(0.9) ) +
ylim(-0.2, 0.4) #where the y axis cuts off
Our group made lots of progress this week particularly with tables, so this is a walkthrough of our progress with table 4 which can be seen below:
Table 4 displays the responses to the two questions asking if the participant heard the cue during the nap. The two questions were asked in an exit questionaire or just casually after the nap.
The relevant variables needed were: - heard_cue_report - heard_cue_exit
Loading and filtering the data
table4 <- read_csv("cleandata.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.
table4 %>%
select(heard_cue_report, heard_cue_exit)
## # A tibble: 31 x 2
## heard_cue_report heard_cue_exit
## <dbl> <dbl>
## 1 0 0
## 2 0 2
## 3 0 0
## 4 0 0
## 5 0 0
## 6 0 0
## 7 0 0
## 8 0 0
## 9 2 0
## 10 0 0
## # ... with 21 more rows
My first attempt used long and repetitive code:
I started by tallying the responses to the exit questionaire where people said “no” which was coded with “0”
Cueexitno <- table4 %>%
tally(heard_cue_exit == 0)
print(Cueexitno)
## # A tibble: 1 x 1
## n
## <int>
## 1 29
Here I realised the problem is that a participant was excluded as they only answered one of the questions. I used drop_na to exclude that participant
Table4.0 <- cleandata %>%
select(heard_cue_report, heard_cue_exit) %>%
drop_na(heard_cue_report)
print(Table4.0)
## heard_cue_report heard_cue_exit
## 1 0 0
## 2 0 2
## 3 0 0
## 4 0 0
## 5 0 0
## 6 0 0
## 7 0 0
## 8 0 0
## 9 2 0
## 10 0 0
## 11 0 2
## 12 0 0
## 13 0 0
## 14 0 0
## 15 0 0
## 16 2 0
## 17 0 0
## 18 0 0
## 19 0 0
## 20 0 0
## 21 0 0
## 22 0 0
## 23 0 0
## 24 0 0
## 25 0 0
## 26 0 0
## 27 0 0
## 28 0 0
## 29 0 0
## 30 0 0
It seemed to work!
Now I am trying to tally the data again for the exit questionnaire
Cueexitnono <- Table4.0 %>%
filter(heard_cue_report == 0) %>%
tally(heard_cue_exit == 0)
print(Cueexitnono)
## n
## 1 26
Cueexitmaybeno <- Table4.0 %>%
filter(heard_cue_report == 0) %>%
tally(heard_cue_exit == 2)
print(Cueexitmaybeno)
## n
## 1 2
and so on
Cuereportmaybeno <- Table4.0 %>%
filter(heard_cue_exit == 0) %>%
tally(heard_cue_report == 2)
print(Cuereportmaybeno)
## n
## 1 2
and so on
Cuereportmaybemaybe <- Table4.0 %>%
filter(heard_cue_exit == 2) %>%
tally(heard_cue_report ==2)
print(Cuereportmaybemaybe)
## n
## 1 0
As you can see it was a lot of chunks for very little data!
Attempting to put all this in simpler code?
I tried to use the add_tally function but this didn’t appear to work the way I wanted it to.
Cueexit <- Table4.0 %>%
filter(heard_cue_report == 0) %>%
add_tally(heard_cue_exit == 0) %>%
add_tally(heard_cue_exit ==2) %>%
print(Cueexit)
Trying to use group_by and then tally.
Group by will group the data using that variable, and tally will tally the responses in each group.
Table4.0 %>%
group_by(heard_cue_report) %>% tally()
## # A tibble: 2 x 2
## heard_cue_report n
## <int> <int>
## 1 0 28
## 2 2 2
print(Table4.0)
## heard_cue_report heard_cue_exit
## 1 0 0
## 2 0 2
## 3 0 0
## 4 0 0
## 5 0 0
## 6 0 0
## 7 0 0
## 8 0 0
## 9 2 0
## 10 0 0
## 11 0 2
## 12 0 0
## 13 0 0
## 14 0 0
## 15 0 0
## 16 2 0
## 17 0 0
## 18 0 0
## 19 0 0
## 20 0 0
## 21 0 0
## 22 0 0
## 23 0 0
## 24 0 0
## 25 0 0
## 26 0 0
## 27 0 0
## 28 0 0
## 29 0 0
## 30 0 0
It worked !
The only problem now is how to calculate, or use R to calculate the total.
As a group we decided to come back to this later and format the table.
As usual we made a tibble for the data.
table4_ <- tibble(
label = c("label", "No", "Maybe", "Total"),
no = c("No", 26, 2, 28),
maybe = c("Maybe", 2, 0, 2),
total = c("Total", 28, 2, 30)
)
print(table4_)
## # A tibble: 4 x 4
## label no maybe total
## <chr> <chr> <chr> <chr>
## 1 label No Maybe Total
## 2 No 26 2 28
## 3 Maybe 2 0 2
## 4 Total 28 2 30
Again, we used the same table principles from the other tables to format table 4:
table4_ %>%
gt(rowname_col = "label") %>%
tab_header(
title = md("**Table 4. Sound cue reporting.**")) %>%
tab_source_note("Participants’ responses to the postnap verbal inquiry and to the exit questionnaire. A response was not recorded for n = 1 participant; this participant reported that they did not hear the sound cue on the final exit questionnaire.") %>%
tab_spanner(
label = md("**Reported Hearing Cue on Verbal Report?**"), #Spanner column label
columns = c(no, maybe, total)
) %>%
tab_stubhead(label = md("**Reported Hearing Cue on Exit Questionnaire?**")
) %>%
cols_label(no = md("**No**"), maybe = md("**Maybe**"), total = md("***Total***"), label = " ")
| Table 4. Sound cue reporting. | |||
|---|---|---|---|
| Reported Hearing Cue on Exit Questionnaire? | Reported Hearing Cue on Verbal Report? | ||
| No | Maybe | Total | |
| label | No | Maybe | Total |
| No | 26 | 2 | 28 |
| Maybe | 2 | 0 | 2 |
| Total | 28 | 2 | 30 |
| Participants’ responses to the postnap verbal inquiry and to the exit questionnaire. A response was not recorded for n = 1 participant; this participant reported that they did not hear the sound cue on the final exit questionnaire. | |||
The next steps are to figure out how to properly calculate the standard deviations for the error bars.
If you compare the original plot to mine, they are similar… but I don’t believe the SD’s I calculated are right!!
I’m not quite sure how to do this as we had to manipulate the original data multiple times to find the differences in implit bias.
i.e. orignal data -> exclusions -> averages for cue conditions and time points -> manipulate that data to find differences
Although I got some insight from other groups, they were provided the data from the study so there was less manipulation of data. I did try the mutate option Sakiko suggested to me during the workshop but I am unsure if I did it right or if it led to the right calculations!
Other steps are to have a go at the other plots which are plotted differently and aren’t bar graphs!
Is the method I used to calculate the standard deviations for figure 4 correct? By: - manipulating the data to calculate changes in implicit bias - using describe to calcualte the SD of the new variables
Or is there another way of calculating SD for these new variables that I could use? I am just unsure as unlike the descriptive data, it’s hard to identify exactly how large the original error bars are, to determine if we have the right values.