Description Usage Arguments Value Examples
within_ci returns lower and upper bounds of confidence intervals
per factor for data with at least one within subject factor.
1 2 |
data: |
Dataframe in long format |
subject: |
Name of single column in data containing participant identifiers |
value: |
Name of single column in data containing values of DV |
conf: |
Confidence interval to be calculated |
ws_factors: |
names of (multiple) columns in data containing within-subject factors |
bs_factors: |
names of (multiple) columns in data containing between-subject factors |
Returns length of Confidence Intervals per factor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # One within factor, no between factors
within_ci(data = data_1w,
subject = subject,
value = DV,
ws_factors = within1)
# Multiple within and between factors
within_ci(data = data_2w2b,
subject = subject,
value = DV,
ws_factors = c(within1, within2),
bs_factors = c(between1, between2))
# Multiple within and between factors with graph
data_2w2b %>%
within_ci(data = .,
subject = subject,
value = DV,
ws_factors = c(within1, within2),
bs_factors = c(between1, between2)) %>%
ggplot(aes(x = within1,
y = sample_mean,
group = within2)) +
geom_bar(stat = "identity",
position = position_dodge(width = 1),
color = "black",
aes(fill = within2)) +
geom_errorbar(position = position_dodge(width = 1),
width = .1,
aes(ymin = sample_mean - CI,
ymax = sample_mean + CI)) +
scale_fill_manual(values = c("white", "grey")) +
labs(y = "DV",
title = "Example bar plot - two within two between") +
theme_classic() +
facet_grid(between1 ~ between2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.