library(osfr)
# get project
<- osf_retrieve_node("k5w3d")
flanker_data
#get file names
<- osf_ls_files(flanker_data)
flanker_files
#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
<- list.files("data", full.names = TRUE)
file_list <- lapply(file_list,rio::import)
all_data <- bind_rows(all_data)
all_data
# RT Analysis
<- all_data %>%
filter_data filter(task == "response",
== TRUE) %>%
correct group_by(ID,distractor) %>%
summarize(subject_mean_rt = mean(rt))
<- filter_data %>%
group_means group_by(distractor) %>%
summarize(group_mean_rt = mean(subject_mean_rt),
sem = sd(subject_mean_rt)/sqrt(length(group_mean_rt)))
::kable(group_means) knitr
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.