Created
June 21, 2020 18:42
-
-
Save richarddmorey/1ae7e2068c9c46e331cd0aac95b0d7e1 to your computer and use it in GitHub Desktop.
Attempt to reproduce Maglio & Polman (2014) Figure 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Get file off OSF | |
tf = tempfile(fileext = ".xlsx") | |
download.file(url = "https://osf.io/846cb/download", destfile = tf) | |
## Create summaries | |
library(tidyverse) | |
readxl::read_xlsx(tf) %>% | |
group_by(STN_NUMBER, DIRECTION) %>% | |
summarise( | |
N = n(), | |
M = mean(DISTANCE), | |
SD = sd(DISTANCE), | |
SE = SD/sqrt(N)) -> sum_data | |
## Print summaries - I cross-checked these with SPSS | |
sum_data | |
## Create plot - I cross-checked this with SPSS | |
sum_data %>% | |
ggplot(aes(x = STN_NUMBER, y = M, group = DIRECTION, color = DIRECTION)) + | |
geom_line() + geom_point() + | |
geom_errorbar(aes(ymin=M-SE,ymax=M+SE), width = .1) + | |
ylim(c(0,5)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment