Import some packages.
library(flextable)
library(tidyverse)
library(broom)
Copy over the table formatting function.
# turn dataframe into html table
<- function(data) {
formatAsTable %>%
data mutate(across(where(is.double), ~ round(., 3))) %>%
%>%
flextable color(color = "white", part = "all")
}
Import the data and look at the top three rows.
<- read_csv(file.path("..", "data", "clean-data.csv")) %>%
chks select(c(interdep, disclose, intcheck, discheck))
%>%
chks head(3) %>%
%>%
formatAsTable autofit
interdep | disclose | intcheck | discheck |
FALSE | FALSE | Neither agree nor disagree | Strongly disagree |
TRUE | TRUE | Somewhat agree | Strongly agree |
TRUE | TRUE | Somewhat disagree | Neither agree nor disagree |
Clean up data for the analyses.
<- c("Strongly agree",
scale_order "Somewhat agree",
"Neither agree nor disagree",
"Somewhat disagree",
"Strongly disagree")
<- 5:1 %>%
scale_key set_names(scale_order)
<- chks %>%
chks mutate(across(ends_with("check"),
~ factor(., scale_order, ordered = T),
.names = "{col}.f")) %>%
mutate(across(ends_with("check"),
~ recode(., !!!scale_key))) %>%
mutate(discor = ifelse(disclose == 0,
< 3,
discheck > 3),
discheck intcor = ifelse(interdep == 0,
< 3,
intcheck > 3)) %>%
intcheck mutate(correct = discor & intcor) %>%
filter(!is.na(intcheck))
How many respondents clicked each scale option in each condition?
%>%
chks count(interdep, intcheck.f) %>%
arrange(interdep, desc(intcheck.f)) %>%
%>%
formatAsTable %>%
autofit bg(bg = "#074005",
i = ~ ifelse(interdep == 0,
< 3,
scale_key[intcheck.f] > 3)) scale_key[intcheck.f]
interdep | intcheck.f | n |
FALSE | Strongly disagree | 100 |
FALSE | Somewhat disagree | 27 |
FALSE | Neither agree nor disagree | 18 |
FALSE | Somewhat agree | 15 |
FALSE | Strongly agree | 7 |
TRUE | Strongly disagree | 3 |
TRUE | Somewhat disagree | 7 |
TRUE | Neither agree nor disagree | 18 |
TRUE | Somewhat agree | 63 |
TRUE | Strongly agree | 76 |
%>%
chks count(disclose, discheck.f) %>%
arrange(disclose, desc(discheck.f)) %>%
%>%
formatAsTable %>%
autofit bg(bg = "#074005",
i = ~ ifelse(disclose == 0,
< 3,
scale_key[discheck.f] > 3)) scale_key[discheck.f]
disclose | discheck.f | n |
FALSE | Strongly disagree | 146 |
FALSE | Somewhat disagree | 9 |
FALSE | Neither agree nor disagree | 3 |
FALSE | Somewhat agree | 7 |
FALSE | Strongly agree | 3 |
TRUE | Somewhat disagree | 2 |
TRUE | Neither agree nor disagree | 4 |
TRUE | Somewhat agree | 13 |
TRUE | Strongly agree | 147 |
Exactly 264 of 334 participants, or 79%, responded to both manipulation checks correctly.
Is there a significant relationship between the manipulation and the manipulation checks?
<- lm(intcheck ~ interdep, chks)
intfit tidy(intfit) %>%
formatAsTable
term | estimate | std.error | statistic | p.value |
(Intercept) | 1.814 | 0.082 | 22.006 | 0 |
interdepTRUE | 2.395 | 0.117 | 20.542 | 0 |
<- lm(discheck ~ disclose, chks)
disfit tidy(disfit) %>%
formatAsTable
term | estimate | std.error | statistic | p.value |
(Intercept) | 1.286 | 0.054 | 23.939 | 0 |
discloseTRUE | 3.552 | 0.076 | 46.619 | 0 |
Output document:
options(knitr.duplicate.label = "allow")
::render("check-pilot-v03-CR.Rmd", output_dir = file.path("..", "github", "thesis")) rmarkdown