library(osfr)
# get project
flanker_data <- osf_retrieve_node("k5w3d")
#get file names
flanker_files <- osf_ls_files(flanker_data)
#download data files
osf_download(flanker_files, path = "data/")flanker-datapipe
The purpose of this website is to test a workflow for persistent jspsych experiments using static webpages.
- The experiment is hosted on this github repository.
- Data is sent to an OSF storage bucket using datapipe.
- Find out if it is possible to use webR to import data from osf, then analyse and plot it.
Flanker experiment
This is just a demo to test the workflow. Clicking this link will load a short 24 trial flanker experiment. No identifying information is collected. The workflow includes sending the reaction time data from each trial to a repository on open-science foundation.
[ x ] - code flanker experiment
[ x ] - make OSF repository
[ x ] - add datapipe to send data to OSF repository
Demo Experiment
https://www.crumplab.com/flanker-datapipe/experiment/flanker.html
OSF project
Analyze results
This approach analyzes the results locally whenever the quarto page is rendered.
library(dplyr)
library(rio)
# import individual json files and merge to tibble
file_list <- list.files("data", full.names = TRUE)
all_data <- lapply(file_list,rio::import)
all_data <- bind_rows(all_data)
# RT Analysis
filter_data <- all_data %>%
filter(task == "response",
correct == TRUE) %>%
group_by(ID,distractor) %>%
summarize(subject_mean_rt = mean(rt))
group_means <- filter_data %>%
group_by(distractor) %>%
summarize(group_mean_rt = mean(subject_mean_rt),
sem = sd(subject_mean_rt)/sqrt(length(group_mean_rt)))
knitr::kable(group_means)| distractor | group_mean_rt | sem |
|---|---|---|
| compatible | 680.2475 | 38.56282 |
| incompatible | 718.3704 | 45.74181 |
webR
webR is a new tool to run R in the browser through web assembly. I’m cobbling together code from these sources:
repo: https://github.com/r-wasm/webr/
documentation: https://docs.r-wasm.org/webr/latest/
quarto example: https://github.com/coatless-r-n-d/webR-quarto-demos
Thanks to all of the webR developers for this!
webR test
This is just a test to see if webR works.
webR
Most R packages are not compiled for webR. Wasn’t able to get it working, but will come back and fiddle sometime soon.