The code in this repository can be used to reproduce the data and analysis used during the SCORE project.
Project code is largely separated by type into Analysis/, pipeline/, and upkeep/.
Analysis/: contains code for data analysispipeline/: contains code run by the targets-based data pipelineupkeep/: contains code that is mostly internal-process focused. These files are not used in any final data processing or analysis, but are included for transparency and general interest.
R version 4.5.0 (2025-04-11)
This project uses the following R packages:
Packages and versions used in the data pipeline and analysis:
- BayesFactor (0.9.12-4.7)
- BayesRep (0.42.2)
- BFF (Version 4.2.1 Required)
- dplyr (1.1.4)
- effectsize (1.0.1)
- ggExtra (0.10.1)
- glue (1.8.0)
- googlesheets4 (1.1.1)
- googledrive (2.1.1)
- here (1.0.1)
- kableExtra (1.4.0)
- lubridate (1.9.4)
- metaBMA (0.6.9)
- metafor (4.8-0)
- osfr (0.2.9)
- purrr (1.0.4)
- pwr (1.3-0)
- readr (2.1.5)
- ReplicationSuccess (1.3.3)
- sjPlot (2.8.17)
- stringr (1.5.1)
- targets (1.11.3)
- tibble (3.3.0)
- tidyr (1.3.1)
- usethis (3.1.0)
- visNetwork (2.1.2)
The following code can be used to install all of these packages:
install.packages(
c(BayesFactor,
BayesRep,
dplyr,
effectsize,
ggExtra,
glue,
googlesheets4,
googledrive,
here,
kableExtra,
lubridate,
metaBMA,
metafor,
osfr,
purrr,
pwr,
readr,
ReplicationSuccess,
rmarkdown,
sjPlot,
stringr,
targets,
tibble,
tidyr,
usethis,
visNetwork)
)
# An older version of the BFF package is required
# Newer versions of this package will cause errors in the data pipeline
pkg <- "https://cran.r-project.org/src/contrib/Archive/BFF/BFF_4.2.1.tar.gz"
install.packages(pkg, repos=NULL, type="source")
The data pipeline uses the R package osfr to download raw data from OSF. If you have not used osfr before, you may also need to complete authentication using osfr::osf_auth() and a token from OSF. See the osfr reference manual for more information.
The code in the pipeline/ folder can be used to reproduce the analytic datasets used in the SCORE project from the raw data found on SCORE Documentation OSF Project.
This project uses the R package {targets} to facilitate reproducibility. Targets is a make-like tool for reproducibly running the code that generates project products, such as analytic datasets, models, and figures.
The file targets.Rmd and the file it generates, targets.html, contains the human-readable documentation of all data products generated and the functions that are used to create them. Rendering this file using rmarkdown::render("targets.Rmd") executes a series of functions in the correct order to build target files (also known as "targets", e.g., intermediate data files, analytic datasets, figures) from source files (e.g., raw data). It also documents the dependencies of the target files, which includes all files (whether source files or other targets) which are used as inputs to the functions used to generate the target file. It also generates the read-only file _targets.R, which configures and defines the pipeline.
Run rmarkdown::render("targets.Rmd") in the console to initiate reproducible targets pipeline on your computer. Please note that this process may run for several minutes and will download files from the OSF when it is first run. See targets.Rmd for more details.
After running rmarkdown::render("targets.Rmd"), during first time setup, you will have access to all SCORE data products. To load any particular dataset into the R environment, use targets::tar_load() with the name of the target you want as the parameter. Multiple datasets can be loaded in at one time by using a concatenated list of target names (e.g., targets::tar_load(c(repli_outcomes, repro_outcomes))). Target names are documented in targets.Rmd.
targets::tar_make()runs the pipeline of functions and stores data and their metadata in the folder_targets/. Renderingtargets.Rmdis required for first-time set up, buttar_make()can be used subsequently to re-run the pipeline.targets::tar_visnetwork(): displays the dependency graph of of all project files.tar::tar_read()andtar::tar_load(): read and load a target's return value, respectively.
Knitting targets.Rmd also runs targets::tar_make() and targets::tar_visnetwork(). Rendering this Rmd file writes scripts to a special _targets_r/ directory to define individual targets and global objects. The targets.html file rendered from the Rmd file can be used to view the documentation for all targets in the pipeline.