Skip to content

Generate a pseudorandom data set to simulate an experiment. This web application is suitable for educational and research purposes in experimental and quantitative sciences. It allows the creation of varied data sets with specified structures, such as between-group and within-participant variables, that can be categorical or continuous.

License

Notifications You must be signed in to change notification settings

pablobernabeu/Experimental-data-simulation

Repository files navigation

Web application for the simulation of experimental data

Purposes

This open-source, R-based web application is suitable for educational and research purposes in experimental and quantitative sciences. It allows the creation of varied data sets with specified structures, such as between-group and within-participant variables that can be categorical or continuous. These parameters can be set throughout the various tabs (sections) from the top menu. In the last tab, the data set can be downloaded. The benefits of this application include time-saving and flexibility in the control of parameters.

Guidelines

General guidelines include the following:

  • In the names of variables, it's recommended only to use alphanumeric characters and underscore signs. The latter can be used to separate characters or words (e.g., variable_name). Different names should be used for each variable.

  • In the levels of categorical variables, alphanumeric, 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 increases, so does the processing time.

More specific guidelines are available in each section.

The web application can be launched here.

Reference

Bernabeu, P., & Lynott, D. (2020). Web application for the simulation of experimental data (Version 1.4). https://github.com/pablobernabeu/Experiment-simulation-app/

Code

This web application was developed in R (R Core Team, 2020). The initial code for this application was influenced by Section 5.7 (Simulating data for multi-factor designs) in Crump (2017). The R packages used include 'dplyr' (Wickham, François, Henry, & Müller, 2018), 'DT' (Xie, 2020), 'flexdashboard' (Iannone, Allaire, & Borges, 2020), 'shiny' (Chang, Cheng, Allaire, Xie, & McPherson, 2020) and 'stringr' (Wickham, 2019).

Options for development and local use of the app

Option A) Using local R/RStudio or RStudio Cloud project or Binder RStudio environment

  1. [Step only necessary in R/RStudio] Install the packages in the versions used in the latest release of this application, by running:

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

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

  4. Click on Open in Browser at the top left.

Option B) Using Dockerfile (@vsoch's pull request)

A Dockerfile has been provided. First, build the container:

docker build -t experiment-shiny-app .

And then run the container, selecting a password for the interface and binding to port 8787 on your local machine.

$ docker run --interactive --rm -e PASSWORD=<MYPASSWORD> -p 8787:8787 --name experiment-shiny-app --volume $(pwd):/home/rstudio experiment-shiny-app
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] add: executing... 
Nothing additional to add
[cont-init.d] add: exited 0.
[cont-init.d] userconf: executing... 
[cont-init.d] userconf: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.

You can then open 127.0.0.1:8787 to see the interface and login with username "rstudio" and your chosen password. You can then select the Rmd file and click "Run Document" to generate the window for the application, shown below.

Acknowledgements

Thank you to RStudio for the free hosting server used by this application, shinyapps.io.

References

Chang, W., Cheng, J., Allaire, J., Xie, Y., & McPherson, J. (2020). shiny: Web Application Framework for R. R package version 1.4.0. Available at http://CRAN.R-project.org/package=shiny.

Crump, M. J. C. (2017). Programming for Psychologists: Data Creation and Analysis (Version 1.1). https://crumplab.github.io/programmingforpsych/.

Iannone, R., Allaire, J. J., & Borges, B. (2020). Flexdashboard: R Markdown Format for Flexible Dashboards. http://rmarkdown.rstudio.com/flexdashboard.

R Core Team (2020). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.

Wickham, H. (2019). stringr: Simple, Consistent Wrappers for Common String Operations. R package version 1.4.0. https://CRAN.R-project.org/package=stringr.

Wickham, H., François, R., Henry, L., & Müller, K. (2018). dplyr: A Grammar of Data Manipulation. R package version 0.7.6. https://CRAN.R-project.org/package=dplyr.

Xie, Y. (2020). DT: A Wrapper of the JavaScript Library "DataTables". R package version 0.14. Available at https://CRAN.R-project.org/package=DT.

Contact

To submit any questions or feedback, please post an issue or email Pablo Bernabeu at [email protected].

About

Generate a pseudorandom data set to simulate an experiment. This web application is suitable for educational and research purposes in experimental and quantitative sciences. It allows the creation of varied data sets with specified structures, such as between-group and within-participant variables, that can be categorical or continuous.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published