Web application for the simulation of experimental data

Web application Open Materials

Abstract

This open-source, R-based web application is suitable for teaching and research in the experimental sciences. It creates varied data sets with specified structures, such as between-group or within-participant variables that can be categorical or continuous. These features are set across the tabs of the app. In the penultimate tab, users can build a custom summary of the current data set, and in the last tab they can download the data set along with the list of parameters.

  Purposes

This open-source, R-based web application is suitable for teaching and research in the experimental and quantitative sciences. It creates varied data sets with specified structures, such as between-group and within-participant variables that can be categorical or continuous. The parameters are set in the tabs (sections) of the top menu, and the data set can be downloaded from the last tab. The application saves time and offers flexible control over the parameters.

How It Works

The diagram below outlines the path from setting the parameters to downloading the simulated data set.

graph TD A["Set parameters across tabs"] --> B["Define between-group
and within-participant
variables"] A --> C["Define independent and
dependent variables"] C --> D["Choose categorical
or continuous"] B --> E["Simulated data set"] D --> E E --> F["Build custom summary
(penultimate tab)"] F --> G["Download parameters and
data set (last tab)"]

Guidelines

General guidelines include the following:

  • In the names of variables, it is best to use only alphanumeric characters and underscores, which can separate words (e.g., variable_name). Each variable needs a different name.

  • In the levels of categorical variables, alphanumeric characters, special characters and spaces are allowed.

  • In numeric fields (e.g., ‘Mean’, ‘Standard deviation’, ‘Relative probability [0, 1]’), only numbers and decimal points are allowed.

  • As the data set grows, so does the processing time.

More specific guidelines are available in each tab.

 The Web Application Can Be Launched Here

Figure 1 shows the Dependent tab, where the parameters of the dependent variables are set.

Screenshot of the Dependent tab in the experimental data simulation web app, showing parameter settings for the dependent variable
Figure 1: The Dependent Tab in Version 0.2 of the App. A larger version is available on GitHub.

How to Cite

To cite this application, please use the Bernabeu and Lynott (2024) entry in the References list below.

Code

This web application was developed in R (R Core Team, 2020). The code is available on GitHub, where contributions are welcome. A copy is archived on Zenodo (Bernabeu & Lynott, 2024). The initial code drew on Section 5.7 (‘Simulating Data for Multi-Factor Designs’) of Crump (2017). The R packages used include dplyr (Wickham et al., 2020), DT (Xie et al., 2020), flexdashboard (Iannone et al., 2020), shiny (Chang et al., 2020) and stringr (Wickham, 2019).

Options for Development and Local Use of the App

The app can be developed or run locally in two ways.

Option A) Using Local R/RStudio or Posit Cloud Project or Binder RStudio Environment

This option involves four steps.

  1. [Only needed in local R/RStudio] Install the package versions used in the latest release of this application by running:

    install.packages('devtools')
    library(devtools)
    install_version('dplyr', '1.0.2', 'https://cloud.r-project.org')
    install_version('DT', '0.15', 'https://cloud.r-project.org')
    install_version('flexdashboard', '0.5.2', 'https://cloud.r-project.org')
    install_version('htmltools', '0.5.0', 'https://cloud.r-project.org')
    install_version('knitr', '1.30', 'https://cloud.r-project.org')
    install_version('ngram', '3.0.4', 'https://cloud.r-project.org')
    install_version('purrr', '0.3.4', 'https://cloud.r-project.org')
    install_version('shiny', '1.5.0', 'https://cloud.r-project.org')
    install_version('stringr', '1.4.0', 'https://cloud.r-project.org')
    install_version('tidyr', '1.1.2', 'https://cloud.r-project.org')
  2. Open the index.Rmd script.

  3. Run the application by clicking ▶️ Run Document at the top left or by running rmarkdown::run('index.Rmd') in the console.

  4. Click Open in Browser at the top left.

Option B) Using Dockerfile

The README of the GitHub repository explains how to build and run the app with the Dockerfile.

Acknowledgements

Thank you to RStudio (now Posit) for hosting this application free of charge on shinyapps.io.

References

Bernabeu, P., & Lynott, D. (2024). Experimental-data-simulation (Version 1.4.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.10615953

Chang, W., Cheng, J., Allaire, J. J., Xie, Y., & McPherson, J. (2020). shiny: Web application framework for R (Version 1.5.0) [Computer software]. Comprehensive R Archive Network (CRAN). https://doi.org/10.32614/CRAN.package.shiny

Crump, M. J. C. (2017). Programming for psychologists: Data creation and analysis (Version 1.1). https://www.crumplab.com/programmingforpsych/

Iannone, R., Allaire, J. J., & Borges, B. (2020). flexdashboard: R Markdown format for flexible dashboards (Version 0.5.2) [Computer software]. Comprehensive R Archive Network (CRAN). https://doi.org/10.32614/CRAN.package.flexdashboard

R Core Team. (2020). R: A language and environment for statistical computing [Computer software]. R Foundation for Statistical Computing. https://www.R-project.org/

Wickham, H. (2019). stringr: Simple, consistent wrappers for common string operations (Version 1.4.0) [Computer software]. Comprehensive R Archive Network (CRAN). https://doi.org/10.32614/CRAN.package.stringr

Wickham, H., François, R., Henry, L., & Müller, K. (2020). dplyr: A grammar of data manipulation (Version 1.0.2) [Computer software]. Comprehensive R Archive Network (CRAN). https://doi.org/10.32614/CRAN.package.dplyr

Xie, Y., Cheng, J., & Tan, X. (2020). DT: A wrapper of the JavaScript library ‘DataTables’ (Version 0.15) [Computer software]. Comprehensive R Archive Network (CRAN). https://doi.org/10.32614/CRAN.package.DT

Contact

Questions and feedback can be posted as an issue or emailed to Pablo Bernabeu at pcbernabeu@gmail.com.

Comments are provided by Disqus and are not loaded automatically. Loading them connects your browser to Disqus, which may use cookies and process data under its privacy policy. See this site's privacy notice for details.