Skip to content

Instantly share code, notes, and snippets.

@richarddmorey
Created June 21, 2020 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richarddmorey/1ae7e2068c9c46e331cd0aac95b0d7e1 to your computer and use it in GitHub Desktop.
Save richarddmorey/1ae7e2068c9c46e331cd0aac95b0d7e1 to your computer and use it in GitHub Desktop.
Attempt to reproduce Maglio & Polman (2014) Figure 1
## 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