├── .Rbuildignore ├── .github ├── .gitignore └── workflows │ ├── R-CMD-check.yaml │ ├── R-check-no_pandoc.yaml │ ├── R-check-readonly.yaml │ ├── check-no-suggests.yaml │ ├── pkgdown.yaml │ └── rhub.yaml ├── .gitignore ├── CITATION.cff ├── DESCRIPTION ├── Dockerfile ├── LICENSE.md ├── Makefile ├── NAMESPACE ├── R ├── add_synthetic.R ├── check_gert.R ├── check_installation.R ├── citations.R ├── codebook.R ├── descriptives.R ├── endpoint.R ├── export.R ├── github.R ├── github_actions.R ├── label_data.R ├── licenses.R ├── load_entrypoint.R ├── misc.R ├── recipes.R ├── report.R ├── save_load.R ├── synthetic.R ├── targets.R ├── ui.R ├── update_worcs_package.R ├── webexercises.R ├── worcs_badge.R ├── worcs_checklist.R ├── worcs_file.R ├── worcs_project.R └── zzz.R ├── README.Rmd ├── README.md ├── _pkgdown.yml ├── codecov.yml ├── collab └── minutes_08-05-2020.md ├── cran-comments.md ├── data └── worcs_checklist.csv ├── docs ├── 404.html ├── LICENSE.html ├── apple-touch-icon-120x120.png ├── apple-touch-icon-152x152.png ├── apple-touch-icon-180x180.png ├── apple-touch-icon-60x60.png ├── apple-touch-icon-76x76.png ├── apple-touch-icon.png ├── articles │ ├── citation.html │ ├── citation_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ ├── endpoints.html │ ├── git_cloud.html │ ├── git_cloud_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ ├── github_download.png │ ├── index.html │ ├── reproduce.html │ ├── reproduce_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ ├── scholar_bib.png │ ├── setup-docker.html │ ├── setup-docker_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ ├── setup.html │ ├── setup_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ ├── synthetic_data.html │ ├── targets.html │ ├── workflow.html │ ├── workflow.png │ └── workflow_files │ │ ├── accessible-code-block-0.0.1 │ │ └── empty-anchor.js │ │ └── header-attrs-2.9 │ │ └── header-attrs.js ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── deps │ ├── bootstrap-5.3.1 │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ └── bootstrap.min.css │ ├── bootstrap-toc-1.0.1 │ │ └── bootstrap-toc.min.js │ ├── clipboard.js-2.0.11 │ │ └── clipboard.min.js │ ├── data-deps.txt │ ├── font-awesome-6.5.2 │ │ ├── css │ │ │ ├── all.css │ │ │ ├── all.min.css │ │ │ ├── v4-shims.css │ │ │ └── v4-shims.min.css │ │ └── webfonts │ │ │ ├── fa-brands-400.ttf │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-regular-400.woff2 │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff2 │ │ │ ├── fa-v4compatibility.ttf │ │ │ └── fa-v4compatibility.woff2 │ ├── headroom-0.11.0 │ │ ├── headroom.min.js │ │ └── jQuery.headroom.min.js │ ├── jquery-3.6.0 │ │ ├── jquery-3.6.0.js │ │ ├── jquery-3.6.0.min.js │ │ └── jquery-3.6.0.min.map │ └── search-1.0.0 │ │ ├── autocomplete.jquery.min.js │ │ ├── fuse.min.js │ │ └── mark.min.js ├── docsearch.css ├── docsearch.js ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon.ico ├── index.html ├── katex-auto.js ├── lightswitch.js ├── link.svg ├── logo.png ├── news.html ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml ├── reference │ ├── Rplot001.png │ ├── add_endpoint.html │ ├── add_license_file.html │ ├── add_manuscript.html │ ├── add_preregistration.html │ ├── add_recipe.html │ ├── add_synthetic.html │ ├── add_targets.html │ ├── check_dependencies.html │ ├── check_endpoints.html │ ├── check_git.html │ ├── check_github.html │ ├── check_renv.html │ ├── check_rmarkdown.html │ ├── check_ssh.html │ ├── check_tinytext.html │ ├── check_worcs.html │ ├── check_worcs_installation.html │ ├── cite_all.html │ ├── cite_essential.html │ ├── citeall.Rmd │ ├── citeall.html │ ├── citeall.md │ ├── citeall_files │ │ └── figure-gfm │ │ │ └── pressure-1.png │ ├── citeessential6dfc21a823d7.Rmd │ ├── citeessential6dfc21a823d7.html │ ├── citeessential6dfc21a823d7.md │ ├── citeessential6dfc21a823d7_files │ │ └── figure-gfm │ │ │ └── pressure-1.png │ ├── closed_data.html │ ├── codebook.html │ ├── data_label.html │ ├── data_unlabel.html │ ├── descfun.html │ ├── descriptives.html │ ├── export_project.html │ ├── figures │ │ └── logo.png │ ├── git_ignore.html │ ├── git_release_publish.html │ ├── git_remote_connect.html │ ├── git_remote_create.html │ ├── git_update.html │ ├── git_user.html │ ├── github_action_check_endpoints.html │ ├── github_action_reproduce.html │ ├── has_git_user.html │ ├── index.html │ ├── load_data.html │ ├── load_entrypoint.html │ ├── notify_synthetic.html │ ├── open_data.html │ ├── report.html │ ├── reproduce.html │ ├── skew_kurtosis.html │ ├── snapshot_endpoints.html │ ├── synthetic.html │ ├── worcs_badge.html │ ├── worcs_checklist.html │ └── worcs_project.html ├── search.json └── sitemap.xml ├── inst └── rstudio │ ├── addins.dcf │ └── templates │ └── project │ ├── licenses │ ├── cc_by-nc-nd_4.0.txt │ ├── cc_by-nc-sa_4.0.txt │ ├── cc_by-nc_4.0.txt │ ├── cc_by-nd_4.0.txt │ ├── cc_by-sa_4.0.txt │ └── cc_by_4.0.txt │ ├── resources │ ├── README.md │ ├── _targets.rmd │ ├── prepare_data.R │ ├── pss.Rmd │ ├── pssr_template.html │ ├── references.bib │ ├── secondary.Rmd │ └── worcs_icon.png │ ├── worcs.dcf │ └── worcs.png ├── man ├── add_endpoint.Rd ├── add_license_file.Rd ├── add_manuscript.Rd ├── add_preregistration.Rd ├── add_recipe.Rd ├── add_synthetic.Rd ├── add_targets.Rd ├── check_endpoints.Rd ├── check_worcs.Rd ├── check_worcs_installation.Rd ├── cite_all.Rd ├── cite_essential.Rd ├── closed_data.Rd ├── codebook.Rd ├── data_label.Rd ├── data_unlabel.Rd ├── descriptives.Rd ├── export_project.Rd ├── figures │ └── logo.png ├── git_ignore.Rd ├── git_remote_connect.Rd ├── git_remote_create.Rd ├── git_update.Rd ├── git_user.Rd ├── github_action_check_endpoints.Rd ├── has_git_user.Rd ├── list_endpoints.Rd ├── load_data.Rd ├── load_entrypoint.Rd ├── notify_synthetic.Rd ├── open_data.Rd ├── remove_endpoint.Rd ├── report.Rd ├── reproduce.Rd ├── skew_kurtosis.Rd ├── snapshot_endpoints.Rd ├── synthetic.Rd ├── worcs_badge.Rd ├── worcs_checklist.Rd └── worcs_project.Rd ├── news.md ├── paper ├── Manuscript.Rmd ├── Manuscript_DS.Rmd ├── Manuscript_DS.md ├── Manuscript_DS.zip ├── Manuscript_JSS.Rmd ├── Manuscript_files │ └── figure-latex │ │ └── scholarbib-1.png ├── affiliation_yaml.R ├── authors.R ├── authors.csv ├── authors_yaml.R ├── camera_ready.zip ├── camera_ready │ ├── Manuscript_DS.Rmd │ ├── Manuscript_DS.html │ ├── README.txt │ ├── preprint.Rmd │ ├── worcs.bib │ ├── workflow.ai │ └── workflow.png ├── connect_rstudio.png ├── create_git_repo.png ├── eadp.pptx ├── fair │ ├── fair_notes.txt │ └── notes fair.txt ├── jss.bst ├── jss.cls ├── jsslogo.jpg ├── notes.Rmd ├── preprint.Rmd ├── rdm notes.txt ├── reviews_ds.Rmd ├── reviews_ds.html ├── reviews_ds.pdf ├── rticles_formats.R ├── update_documentation.R ├── worcs.bib ├── worcs_badge.ai ├── worcs_badge2.ai ├── worcs_badge3.ai ├── worcs_badge4.ai ├── worcs_badge5.ai ├── worcs_banner.ai ├── worcs_nobanner.ai ├── workflow.png └── workflow_graph │ ├── Attribution_for_images.txt │ ├── Git-Icon-Black.eps │ ├── Git-Icon-Black.png │ ├── WORCS-open-brightgreen.svg │ ├── camera.svg │ ├── clock.svg │ ├── cloud.png │ ├── cloud.svg │ ├── email.svg │ ├── exam.svg │ ├── fiver feedback.txt │ ├── fix.svg │ ├── microsoft-excel.svg │ ├── osf_black.png │ ├── pdf.svg │ ├── review.svg │ ├── revisions2 │ ├── rmd.svg │ ├── worcs_viz.svg │ ├── workflow.ai │ ├── workflow.png │ ├── workflow.svg │ ├── workflow.vsdx │ └── workflow_cj.ai ├── pkgdown ├── extra.css ├── extra.js └── favicon │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-152x152.png │ ├── apple-touch-icon-180x180.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ └── favicon.ico ├── repro.ai ├── tests ├── testthat.R └── testthat │ ├── helper_usethis.R │ ├── test-add_manuscript.R │ ├── test-add_preregistration.R │ ├── test-can_clone.R │ ├── test-check_worcs_installation.R │ ├── test-checksum_git_nogit.R │ ├── test-checksum_line_endings.R │ ├── test-checksum_markdown.R │ ├── test-citations.R │ ├── test-closed_data.R │ ├── test-codebook.R │ ├── test-descriptives.R │ ├── test-dir_of_save_data.R │ ├── test-export_project.R │ ├── test-github.R │ ├── test-reproduce.R │ ├── test-save_load_expression.R │ ├── test-synthetic.R │ ├── test-targets.R │ ├── test-test-synthetic.R │ ├── test-worcs_project.R │ ├── test-worcsfile.R │ ├── test.yaml │ └── testthat-problems.rds ├── vignettes ├── citation.Rmd ├── endpoints.Rmd ├── gh_release.png ├── git_cloud.Rmd ├── github_download.png ├── reproduce.Rmd ├── scholar_bib.png ├── setup-docker.Rmd ├── setup.Rmd ├── synthetic_data.Rmd ├── targets.Rmd ├── vignettes.bib ├── workflow.Rmd └── workflow.png └── worcs.Rproj /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^renv$ 2 | ^renv\.lock$ 3 | ^.*\.Rproj$ 4 | ^\.Rproj\.user$ 5 | ^_pkgdown\.yml$ 6 | ^docs$ 7 | ^pkgdown$ 8 | ^collab$ 9 | ^paper$ 10 | ^README\.Rmd$ 11 | ^README\.md$ 12 | ^LICENSE\.md$ 13 | ^cran-comments\.md 14 | ^news\.md 15 | ^CRAN-RELEASE$ 16 | ^codebook.*$ 17 | Makefile 18 | ^\.worcs$ 19 | ^.*\.ai$ 20 | ^doc$ 21 | ^Meta$ 22 | Dockerfile 23 | ^\.github$ 24 | ^CITATION\.cff$ 25 | ^CRAN-SUBMISSION$ 26 | ^codecov\.yml$ 27 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | 9 | name: R-CMD-check 10 | 11 | jobs: 12 | R-CMD-check: 13 | runs-on: ${{ matrix.config.os }} 14 | 15 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 16 | 17 | strategy: 18 | fail-fast: false 19 | matrix: 20 | config: 21 | - {os: macos-latest, r: 'release'} 22 | - {os: windows-latest, r: 'release'} 23 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 24 | - {os: ubuntu-latest, r: 'release'} 25 | - {os: ubuntu-latest, r: 'oldrel-1'} 26 | 27 | env: 28 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 29 | R_KEEP_PKG_SOURCE: yes 30 | 31 | steps: 32 | - uses: actions/checkout@v4 33 | 34 | - uses: r-lib/actions/setup-pandoc@v2 35 | 36 | - uses: r-lib/actions/setup-r@v2 37 | with: 38 | r-version: ${{ matrix.config.r }} 39 | http-user-agent: ${{ matrix.config.http-user-agent }} 40 | use-public-rspm: true 41 | 42 | - uses: r-lib/actions/setup-r-dependencies@v2 43 | with: 44 | extra-packages: any::rcmdcheck 45 | needs: check 46 | 47 | - uses: r-lib/actions/check-r-package@v2 48 | with: 49 | upload-snapshots: true 50 | -------------------------------------------------------------------------------- /.github/workflows/R-check-no_pandoc.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | 9 | name: R-check-no_pandoc 10 | 11 | jobs: 12 | R-CMD-check: 13 | runs-on: ${{ matrix.config.os }} 14 | 15 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 16 | 17 | strategy: 18 | fail-fast: false 19 | matrix: 20 | config: 21 | - {os: macos-latest, r: 'release'} 22 | 23 | env: 24 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 25 | R_KEEP_PKG_SOURCE: yes 26 | 27 | steps: 28 | - uses: actions/checkout@v4 29 | 30 | - uses: r-lib/actions/setup-r@v2 31 | with: 32 | r-version: ${{ matrix.config.r }} 33 | http-user-agent: ${{ matrix.config.http-user-agent }} 34 | use-public-rspm: true 35 | 36 | - uses: r-lib/actions/setup-r-dependencies@v2 37 | with: 38 | extra-packages: any::rcmdcheck 39 | needs: check 40 | 41 | - uses: r-lib/actions/check-r-package@v2 42 | with: 43 | upload-snapshots: true 44 | -------------------------------------------------------------------------------- /.github/workflows/R-check-readonly.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] # Trigger on pushes to main or master 6 | paths: 7 | - .github/workflows/R-check-readonly.yaml # Also trigger if this workflow file changes 8 | pull_request: 9 | branches: [main, master] # Trigger on pull requests targeting main or master 10 | workflow_dispatch: # Allow manual triggers 11 | 12 | 13 | name: R Testthat Readonly 14 | 15 | jobs: 16 | R-CMD-check: 17 | runs-on: ${{ matrix.config.os }} 18 | 19 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 20 | 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | config: 25 | - {os: ubuntu-latest, r: 'release'} 26 | 27 | env: 28 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 29 | R_KEEP_PKG_SOURCE: yes 30 | 31 | steps: 32 | - uses: actions/checkout@v4 33 | 34 | - uses: r-lib/actions/setup-pandoc@v2 35 | 36 | - uses: r-lib/actions/setup-r@v2 37 | with: 38 | r-version: ${{ matrix.config.r }} 39 | http-user-agent: ${{ matrix.config.http-user-agent }} 40 | use-public-rspm: true 41 | 42 | - uses: r-lib/actions/setup-r-dependencies@v2 43 | with: 44 | extra-packages: any::rcmdcheck 45 | needs: check 46 | 47 | - name: Make user library read-only 48 | run: | 49 | Rscript -e 'Sys.chmod(.libPaths()[1], mode = "0555")' 50 | 51 | - uses: r-lib/actions/check-r-package@v2 52 | with: 53 | upload-snapshots: false -------------------------------------------------------------------------------- /.github/workflows/check-no-suggests.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | # 4 | # NOTE: This workflow only directly installs "hard" dependencies, i.e. Depends, 5 | # Imports, and LinkingTo dependencies. Notably, Suggests dependencies are never 6 | # installed, with the exception of testthat, knitr, and rmarkdown. The cache is 7 | # never used to avoid accidentally restoring a cache containing a suggested 8 | # dependency. 9 | on: 10 | push: 11 | branches: [main, master] 12 | pull_request: 13 | 14 | name: check-no-suggests.yaml 15 | 16 | permissions: read-all 17 | 18 | jobs: 19 | check-no-suggests: 20 | runs-on: ${{ matrix.config.os }} 21 | 22 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 23 | 24 | strategy: 25 | fail-fast: false 26 | matrix: 27 | config: 28 | - {os: ubuntu-latest, r: 'release'} 29 | 30 | env: 31 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 32 | R_KEEP_PKG_SOURCE: yes 33 | 34 | steps: 35 | - uses: actions/checkout@v4 36 | 37 | - uses: r-lib/actions/setup-pandoc@v2 38 | 39 | - uses: r-lib/actions/setup-r@v2 40 | with: 41 | r-version: ${{ matrix.config.r }} 42 | http-user-agent: ${{ matrix.config.http-user-agent }} 43 | use-public-rspm: true 44 | 45 | - uses: r-lib/actions/setup-r-dependencies@v2 46 | with: 47 | dependencies: '"hard"' 48 | cache: false 49 | extra-packages: | 50 | any::rcmdcheck 51 | any::testthat 52 | any::knitr 53 | any::rmarkdown 54 | needs: check 55 | 56 | - uses: r-lib/actions/check-r-package@v2 57 | with: 58 | upload-snapshots: true 59 | build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' 60 | -------------------------------------------------------------------------------- /.github/workflows/pkgdown.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | release: 8 | types: [published] 9 | workflow_dispatch: 10 | 11 | name: pkgdown.yaml 12 | 13 | permissions: read-all 14 | 15 | jobs: 16 | pkgdown: 17 | runs-on: ubuntu-latest 18 | # Only restrict concurrency for non-PR jobs 19 | concurrency: 20 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} 21 | env: 22 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 23 | permissions: 24 | contents: write 25 | steps: 26 | - uses: actions/checkout@v4 27 | 28 | - uses: r-lib/actions/setup-pandoc@v2 29 | 30 | - uses: r-lib/actions/setup-r@v2 31 | with: 32 | use-public-rspm: true 33 | 34 | - uses: r-lib/actions/setup-r-dependencies@v2 35 | with: 36 | extra-packages: any::pkgdown, local::. 37 | needs: website 38 | 39 | - name: Build site 40 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) 41 | shell: Rscript {0} 42 | 43 | - name: Deploy to GitHub pages 🚀 44 | if: github.event_name != 'pull_request' 45 | uses: JamesIves/github-pages-deploy-action@v4.5.0 46 | with: 47 | clean: false 48 | branch: gh-pages 49 | folder: docs 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | inst/doc 6 | *.fff 7 | *.log 8 | *.pdf 9 | *.tex 10 | *.docx 11 | doc 12 | Meta 13 | *.bbl 14 | *.blg 15 | authors_latex.txt 16 | !reviews_ds.pdf 17 | /doc/ 18 | /Meta/ 19 | docs 20 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: worcs 2 | Type: Package 3 | Title: Workflow for Open Reproducible Code in Science 4 | Version: 0.1.19 5 | Authors@R: c( 6 | person( 7 | given = c("Caspar", "J."), 8 | family = "Van Lissa", 9 | email = "c.j.vanlissa@tilburguniversity.edu", 10 | role = c("aut", "cre"), 11 | comment = c(ORCID = "0000-0002-0808-5024") 12 | ), 13 | person( 14 | "Aaron", 15 | "Peikert", 16 | role = c("aut"), 17 | comment = c(ORCID = "0000-0001-7813-818X") 18 | ), 19 | person( 20 | c("Andreas", "M."), 21 | "Brandmaier", 22 | role = "aut", 23 | comment = c(ORCID = "0000-0001-8765-6982") 24 | ) 25 | ) 26 | Description: Create reproducible and transparent research projects in 'R'. 27 | This package is based on the Workflow for Open 28 | Reproducible Code in Science (WORCS), a step-by-step procedure based on best 29 | practices for 30 | Open Science. It includes an 'RStudio' project template, several 31 | convenience functions, and all dependencies required to make your project 32 | reproducible and transparent. WORCS is explained in the tutorial paper 33 | by Van Lissa, Brandmaier, Brinkman, Lamprecht, Struiksma, & Vreede (2021). 34 | . 35 | License: GPL (>= 3) 36 | Encoding: UTF-8 37 | LazyData: true 38 | URL: https://github.com/cjvanlissa/worcs, https://cjvanlissa.github.io/worcs/ 39 | RoxygenNote: 7.3.2 40 | Roxygen: list(markdown = TRUE) 41 | Imports: 42 | methods, 43 | rmarkdown, 44 | renv, 45 | prereg (>= 0.6.0), 46 | gert (>= 2.0.1), 47 | ranger, 48 | yaml, 49 | digest, 50 | rticles (>= 0.27), 51 | tinytex, 52 | credentials, 53 | usethis (>= 3.1.0), 54 | gh, 55 | xfun, 56 | cli, 57 | rlang 58 | Suggests: 59 | papaja (>= 0.1.1), 60 | targets (>= 1.11.1), 61 | lavaan, 62 | tidySEM, 63 | tarchetypes, 64 | remotes, 65 | knitr, 66 | missRanger, 67 | curl, 68 | fs, 69 | withr, 70 | desc, 71 | purrr, 72 | testthat (>= 2.1.0) 73 | SystemRequirements: pandoc (>= 1.14) - https://pandoc.org 74 | VignetteBuilder: knitr 75 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/verse:4.0.3 2 | RUN apt-get update \ 3 | && apt-get install -y --no-install-recommends \ 4 | libgit2-dev \ 5 | libgsl-dev \ 6 | && installGithub.r --deps TRUE --update FALSE \ 7 | cjvanlissa/worcs \ 8 | crsh/papaja 9 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PKGNAME := $(shell sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION) 2 | PKGVERS := $(shell sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION) 3 | PKGSRC := $(shell basename `pwd`) 4 | 5 | all: rd readme check clean 6 | 7 | pkgdown: 8 | Rscript -e 'pkgdown::build_site()' 9 | 10 | rd: 11 | Rscript -e 'roxygen2::roxygenise(".")' 12 | 13 | readme: 14 | Rscript -e 'rmarkdown::render("README.Rmd", "md_document")' 15 | 16 | build: 17 | cd ..;\ 18 | R CMD build $(PKGSRC) 19 | 20 | install: 21 | cd ..;\ 22 | R CMD INSTALL $(PKGNAME)_$(PKGVERS).tar.gz 23 | 24 | 25 | check: build 26 | cd ..;\ 27 | R CMD check --as-cran $(PKGNAME)_$(PKGVERS).tar.gz 28 | 29 | paper/Manuscript.pdf: paper/Manuscript.Rmd 30 | cd paper;\ 31 | Rscript -e 'rmarkdown::render("Manuscript.Rmd")' 32 | cd ..;\ 33 | -------------------------------------------------------------------------------- /R/check_gert.R: -------------------------------------------------------------------------------- 1 | gert_works <- function() { 2 | dir_name <- file.path(tempfile()) 3 | if (dir.exists(dir_name)) 4 | unlink(dir_name, recursive = TRUE, force = TRUE) 5 | dir.create(dir_name) 6 | on.exit(unlink(dir_name, recursive = TRUE), add = TRUE) 7 | pass <- !inherits(try({ 8 | gert::git_init(dir_name) 9 | }, silent = TRUE) 10 | , "try-error") 11 | if (!pass) 12 | return(FALSE) 13 | pass <- !inherits(try({ 14 | if (gert::user_is_configured(dir_name)) { 15 | gert::git_config_set("user.name", "Gert test", repo = dir_name) 16 | gert::git_config_set("user.email", "gert_test@gmail.com", repo = dir_name) 17 | } 18 | if (!gert::user_is_configured(dir_name)) 19 | stop() 20 | }, silent = TRUE) 21 | , "try-error") 22 | if (!pass) 23 | return(FALSE) 24 | pass <- !inherits(try({ 25 | gert::git_init() 26 | }, silent = TRUE) 27 | , "try-error") 28 | if (!pass) 29 | return(FALSE) 30 | pass <- !inherits(try({ 31 | writeLines("test git", con = file.path(dir_name, "tmp.txt")) 32 | tmp <- gert::git_add(".", repo = dir_name) 33 | if (!isTRUE(tmp$staged)) 34 | stop() 35 | }, silent = TRUE) 36 | , "try-error") 37 | if (!pass) 38 | return(FALSE) 39 | 40 | pass <- 41 | !inherits(try(gert::git_commit("First commit", repo = dir_name), 42 | silent = TRUE) 43 | , "try-error") 44 | if (!pass) 45 | return(FALSE) 46 | return(TRUE) 47 | } 48 | -------------------------------------------------------------------------------- /R/label_data.R: -------------------------------------------------------------------------------- 1 | make_labels <- function(data, variables = names(data)[sapply(data, inherits, what = "factor")], filename = "value_labels.yml"){ 2 | df <- data[variables] 3 | out <- lapply(df, function(i){ 4 | whatclass <- class(i)[1] 5 | res <- levels(i) 6 | names(res) <- 1:length(levels(i)) 7 | c(list(class = whatclass), as.list(res)) 8 | }) 9 | yaml::write_yaml(out, file = filename) 10 | } 11 | 12 | # read_labels <- function(filename = "value_labels.yml"){ 13 | # labs <- yaml::read_yaml(filename) 14 | # class(labs) <- c("value_labels", class(labs)) 15 | # labs 16 | # } 17 | 18 | 19 | #' @title Drop value labels 20 | #' @description Coerces `factor` and `ordered` variables to class `integer`. 21 | #' @param x A `data.frame`. 22 | #' @param variables Column names of `x` to coerce to integer. 23 | #' @return A `data.frame`. 24 | #' @examples 25 | #' \dontrun{ 26 | #' if(interactive()){ 27 | #' df <- data.frame(x = factor(c("a", "b"))) 28 | #' df <- data_unlabel(df) 29 | #' } 30 | #' } 31 | #' @rdname data_unlabel 32 | #' @export 33 | data_unlabel <- function(x, variables = names(x)[sapply(x, inherits, what = "factor")]){ 34 | if(length(variables) > 0){ 35 | x[variables] <- lapply(x[variables], as.integer) 36 | } 37 | x 38 | } 39 | 40 | #' @title Label factor variables using metadata 41 | #' @description For each column of `x`, this function checks whether value 42 | #' labels exist in `value_labels`. If so, integer values are replaced with these 43 | #' value labels. 44 | #' @param x A `data.frame`. 45 | #' @param variables Column names of `x` to replace, Default: `names(x)` 46 | #' @param value_labels A list with value labels, typically read from metadata 47 | #' generated by \code{\link{open_data}} or \code{\link{closed_data}}. 48 | #' Default: `read_yaml(paste0("value_labels_", substitute(x), ".yml"))` 49 | #' @return A `data.frame`. 50 | #' @examples 51 | #' \dontrun{ 52 | #' if(interactive()){ 53 | #' labs <- list(x = list(class = "factor", `1` = "a", `2` = "b")) 54 | #' df <- data.frame(x = 1:2) 55 | #' df <- data_label(df, value_labels = labs) 56 | #' } 57 | #' } 58 | #' @rdname data_label 59 | #' @export 60 | data_label <- function(x, variables = names(x), value_labels = read_yaml(paste0("value_labels_", substitute(x), ".yml"))){ 61 | out <- x 62 | for(nam in variables){ 63 | if(!nam %in% names(value_labels)){ 64 | next 65 | } 66 | if(inherits(x[[nam]], what = value_labels[[nam]][[1]])){ 67 | next 68 | } 69 | switch(value_labels[[nam]][["class"]], 70 | "factor" = { 71 | out[[nam]] <- factor(x[[nam]], levels = names(value_labels[[nam]])[-1], labels = unlist(value_labels[[nam]][-1])) 72 | }, 73 | "ordered" = { 74 | out[[nam]] <- ordered(x[[nam]], levels = names(value_labels[[nam]])[-1], labels = unlist(value_labels[[nam]][-1])) 75 | }) 76 | } 77 | out 78 | } 79 | 80 | 81 | -------------------------------------------------------------------------------- /R/licenses.R: -------------------------------------------------------------------------------- 1 | #' @title Add License File to Project 2 | #' @description This function wraps `usethis`' 3 | #' \code{\link[usethis:licenses]{licenses}} functions, which are 4 | #' designed for R-packages. This function makes them applicable to other use 5 | #' cases (e.g., WORCS projects, FAIR theory). 6 | #' @param path Character, indicating the directory in which to create the 7 | #' license file. Default: '.'. 8 | #' @param license Character, indicating which license function to call. 9 | #' The `usethis` functions all have the form `use_{licensename}_license()`. 10 | #' The `license` argument consists only of the `{licensename}`, e.g. `ccby`. 11 | #' @param ... Additional arguments passed to `usethis` function. 12 | #' @return No return value. This function is called for its side effects. 13 | #' @examples 14 | #' if(requireNamespace("withr", quietly = TRUE)){ 15 | #' withr::with_tempdir({ 16 | #' add_license_file(path = ".", 17 | #' license = "proprietary", 18 | #' copyright_holder = "test") 19 | #' }) 20 | #' } 21 | #' @rdname add_license_file 22 | #' @export 23 | add_license_file <- function(path = ".", license = "ccby", ...){ 24 | legal_licenses <- c( 25 | "cc0", 26 | "ccby", 27 | "gpl", 28 | "gpl3", 29 | "agpl", 30 | "agpl3", 31 | "apache", 32 | "apl2", 33 | "lgpl", 34 | "mit", 35 | "proprietary", 36 | "none" 37 | ) 38 | if(!license %in% legal_licenses){ 39 | cli_msg("!" = "License {.val {license}} does not correspond to any license in `usethis`, see {.code ?usethis::use_cc0_license}.") 40 | if(grepl("cc_by", tolower(license))) license <- "ccby" 41 | } 42 | tmpdr <- file.path(tempdir(), "lcns") 43 | dir.create(tmpdr) 44 | on.exit(unlink(tmpdr, recursive = TRUE)) 45 | cl <- match.call() 46 | cl[[1L]] <- str2lang(paste0("usethis::use_", license, "_license")) 47 | cl[["path"]] <- NULL 48 | cl[["license"]] <- NULL 49 | dots <- list(...) 50 | if(length(dots) > 0) cl[names(dots)] <- dots 51 | with_cli_try("Writing license file", { 52 | if(!license %in% legal_licenses) stop() 53 | usethis::ui_silence({ 54 | usethis::with_project(tmpdr, code = { 55 | eval.parent(cl) 56 | }, force = TRUE) 57 | }) 58 | flz <- list.files(tmpdr) 59 | flz <- grep("^license", flz, ignore.case = TRUE, value = TRUE) 60 | if(!length(flz) == 1) stop() 61 | out <- file.copy(file.path(tmpdr, flz), to = file.path(path, flz)) 62 | if(!out) stop() 63 | }) 64 | } 65 | -------------------------------------------------------------------------------- /R/load_entrypoint.R: -------------------------------------------------------------------------------- 1 | #' @title Load project entry points 2 | #' @description Loads the designated project entry point into the default 3 | #' editor, using \code{\link[utils]{file.edit}}. 4 | #' @param worcs_directory Character, indicating the WORCS project directory to 5 | #' which to save data. The default value \code{"."} points to the current 6 | #' directory. 7 | #' @param verbose Logical. Whether or not to print status messages to 8 | #' the console. Default: TRUE 9 | #' @param ... Additional arguments passed to \code{\link[utils]{file.edit}}. 10 | #' @return No return value. This function is called for its side effects. 11 | #' @examples 12 | #' \dontrun{ 13 | #' if(requireNamespace("withr", quietly = TRUE)){ 14 | #' withr::with_tempdir({ 15 | #' # Prepare worcs file and dummy entry point 16 | #' worcs:::write_worcsfile(".worcs", entry_point = "test.txt") 17 | #' writeLines("Hello world", con = file("test.txt", "w")) 18 | #' # Demonstrate load_entrypoint() 19 | #' load_entrypoint() 20 | #' }) 21 | #' } 22 | #' } 23 | #' @rdname load_entrypoint 24 | #' @importFrom utils file.edit 25 | #' @export 26 | load_entrypoint <- function(worcs_directory = ".", verbose = TRUE, ...){ 27 | cl <- as.list(match.call()[-1]) 28 | # Filenames housekeeping 29 | dn_worcs <- dirname(check_recursive(file.path(normalizePath(worcs_directory), ".worcs"))) 30 | fn_worcs <- file.path(dn_worcs, ".worcs") 31 | if(file.exists(fn_worcs)){ 32 | worcsfile <- read_yaml(fn_worcs) 33 | col_message("Loading .worcs file.", verbose = verbose) 34 | } else { 35 | stop("No .worcs file found.") 36 | } 37 | if(!is.null(worcsfile[["entry_point"]])){ 38 | for(thisfile in worcsfile[["entry_point"]]){ 39 | tryCatch({ 40 | thepath <- file.path(dn_worcs, thisfile) 41 | cl <- c(thepath, cl) 42 | cl[!names(cl) %in% c("title", "editor", "fileEncoding")] <- NULL 43 | do.call(file.edit, cl) 44 | col_message("Loading entry point '", thisfile, "'.", verbose = verbose) 45 | }, error = function(e){ 46 | col_message("Could not load entry point '", thisfile, "'.", verbose = verbose, success = FALSE) 47 | }) 48 | } 49 | } else { 50 | stop("No .worcs file found.") 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /R/report.R: -------------------------------------------------------------------------------- 1 | #' Report formatted number 2 | #' 3 | #' Report a number, rounded to a specific number of decimals (defaults to two), 4 | #' using \code{\link{formatC}}. Intended for 'R Markdown' reports. 5 | #' @param x Numeric. Value to be reported 6 | #' @param digits Integer. Number of digits to round to. 7 | #' @param equals Logical. Whether to report an equals (or: smaller than) sign. 8 | #' @return An atomic character vector. 9 | #' @author Caspar J. van Lissa 10 | #' @keywords internal 11 | #' @export 12 | #' @examples 13 | #' if(interactive()){ 14 | #' report(.0234) 15 | #' } 16 | report <- function(x, digits = 2, equals = TRUE){ 17 | equal_sign <- "= " 18 | if(x%%1==0){ 19 | outstring <- format_with_na(x, digits = 0, format = "f") 20 | } else { 21 | if(abs(x) < 10^-digits){ 22 | equal_sign <- "< " 23 | outstring <- 10^-digits 24 | } else { 25 | outstring <- format_with_na(x, digits = digits, format = "f") 26 | } 27 | } 28 | ifelse(equals, paste0(equal_sign, outstring), outstring) 29 | } 30 | 31 | format_with_na <- function(x, ...){ 32 | cl <- match.call() 33 | missings <- is.na(x) 34 | out <- rep(NA, length(x)) 35 | cl$x <- na.omit(x) 36 | cl[[1L]] <- quote(formatC) 37 | out[!missings] <- eval.parent(cl) 38 | out 39 | } 40 | -------------------------------------------------------------------------------- /R/ui.R: -------------------------------------------------------------------------------- 1 | with_cli_try <- function(msg, code, ...){ 2 | tryCatch({ 3 | if(!is_quiet()) cli::cli_process_start(msg, ..., .envir = parent.frame(1)) 4 | eval(code, envir = parent.frame()) 5 | cli::cli_process_done() 6 | return(invisible(TRUE)) 7 | }, error = function(err) { 8 | cli::cli_process_failed() 9 | return(invisible(FALSE)) 10 | }) 11 | } 12 | 13 | cli_msg <- function(...){ 14 | if(!is_quiet()) do.call(cli::cli_bullets, list(text = as.vector(list(...))), envir = parent.frame(n = 1)) 15 | } 16 | 17 | is_quiet <- function() { 18 | isTRUE(getOption("usethis.quiet", default = !interactive())) 19 | } 20 | 21 | #' @importFrom usethis ui_oops ui_done 22 | col_message <- function (..., col = 30, success = TRUE, verbose = !getOption("usethis.quiet", default = FALSE)){ 23 | if(verbose){ 24 | txt <- do.call(paste0, list(...)) 25 | # Check if this function is called from within an rmarkdown document. 26 | # If that is the case, the colorized messages can cause knitting errors. 27 | if(!any(grepl("rmarkdown", unlist(lapply(sys.calls(), `[[`, 1)), fixed = TRUE))){ 28 | if(success){ 29 | cli::cli_bullets(text = c("v" = txt)) 30 | } else { 31 | cli::cli_bullets(text = c("x" = txt)) 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /R/update_worcs_package.R: -------------------------------------------------------------------------------- 1 | if(FALSE){ 2 | 3 | # Update manuscript templates --------------------------------------------- 4 | 5 | 6 | library(rticles) 7 | tem_rticles <- lsf.str("package:rticles") 8 | tem_rticles <- tem_rticles[grep("_article", tem_rticles)] 9 | library(papaja) 10 | pap_rticles <- lsf.str("package:papaja") 11 | file_content <- readLines("inst/rstudio/templates/project/worcs.dcf") 12 | line_num <- grep("Fields:", file_content)[grep("Fields:", file_content) > grep("Parameter: manuscript", file_content)][1] 13 | # current <- current[grep("Parameter: manuscript", current):grep("Parameter: preregistration", current)] 14 | # current <- current[startsWith(current, "Fields:")] 15 | current <- file_content[line_num] 16 | current <- gsub("Fields: ", "", current, fixed = T) 17 | current <- strsplit(current, ',')[[1]] 18 | current <- trimws(current) 19 | 20 | defaults <- c("github_document", "APA6", "None", "target_markdown") 21 | 22 | 23 | file_content[line_num] <- paste0("Fields: ", paste0(c(defaults, tem_rticles), collapse = ", ")) 24 | writeLines(file_content, "inst/rstudio/templates/project/worcs.dcf") 25 | 26 | descfile <- readLines("DESCRIPTION") 27 | descfile[grep("rticles", descfile)] <- gsub("\\(>=(.+?)\\)", paste0("\\(>= ", packageVersion("rticles"), "\\)"), descfile[grep("rticles", descfile)]) 28 | writeLines(descfile, "DESCRIPTION") 29 | 30 | # Update prereg templates ------------------------------------------------- 31 | 32 | library(prereg) 33 | tem_prereg <- lsf.str("package:prereg") 34 | tem_prereg <- tem_prereg[grep("_prereg", tem_prereg)] 35 | 36 | 37 | file_content <- readLines("inst/rstudio/templates/project/worcs.dcf") 38 | line_num <- grep("Fields:", file_content)[grep("Fields:", file_content) > grep("Parameter: preregistration", file_content)][1] 39 | # current <- current[grep("Parameter: manuscript", current):grep("Parameter: preregistration", current)] 40 | # current <- current[startsWith(current, "Fields:")] 41 | current <- file_content[line_num] 42 | current <- gsub("Fields: ", "", current, fixed = T) 43 | current <- strsplit(current, ',')[[1]] 44 | current <- trimws(current) 45 | 46 | defaults <- c("None", "PSS", "Secondary") 47 | 48 | file_content[line_num] <- paste0("Fields: ", paste0(c(defaults, tem_prereg), collapse = ", ")) 49 | writeLines(file_content, "inst/rstudio/templates/project/worcs.dcf") 50 | 51 | descfile <- readLines("DESCRIPTION") 52 | descfile[grep("prereg", descfile)] <- gsub("\\(>=(.+?)\\)", paste0("\\(>= ", packageVersion("prereg"), "\\)"), descfile[grep("prereg", descfile)]) 53 | writeLines(descfile, "DESCRIPTION") 54 | 55 | } 56 | -------------------------------------------------------------------------------- /R/webexercises.R: -------------------------------------------------------------------------------- 1 | # quizz <- function(..., render_if = knitr::is_html_output(), title = "Quiz", show_box = TRUE, show_check = TRUE){ 2 | # if(render_if){ 3 | # if(requireNamespace("webexercises", quietly = TRUE)){ 4 | # dots <- list(...) 5 | # # Check if a file is provided instead of multiple questions 6 | # if(length(dots) == 1){ 7 | # if(file.exists(dots[[1]])){ 8 | # txt <- readLines(dots[[1]]) 9 | # questionz <- lapply(txt, function(q){ 10 | # spl <- regexpr("=", q) 11 | # trimws(substring(q, c(1, spl+1), c(spl-1, nchar(q)))) 12 | # }) 13 | # dots <- lapply(questionz, function(q){ 14 | # eval(parse(text = q[2])) 15 | # }) 16 | # names(dots) <- trimws(sapply(questionz, `[`, 1)) 17 | # } 18 | # } 19 | # # Now, prepare the HTML code 20 | # if(show_box | show_check){ 21 | # classes <- paste0(' class = "', 22 | # trimws(paste0(c(c("", "webex-check")[show_check+1L], 23 | # c("", "webex-box")[show_box+1L]), collapse = " ")), '"') 24 | # } 25 | # intro <- paste0('
\n\n

\n', title, '

\n

\n') 26 | # outro <- '\n

\n
\n
' 27 | # 28 | # questions <- sapply(dots, function(q){ 29 | # switch(class(q)[1], 30 | # "character" = { 31 | # opts <- q 32 | # names(opts)[1] <- "answer" 33 | # browser() 34 | # webexercises::mcq(sample(opts)) 35 | # }, 36 | # "logical" = { 37 | # webexercises::torf(q) 38 | # }, 39 | # "numeric" = { 40 | # 41 | # if(length(q) == 1){ 42 | # webexercises::fitb(answer = q) 43 | # } else { 44 | # webexercises::fitb(answer = q[1], tol = q[2]) 45 | # } 46 | # 47 | # }, 48 | # "integer" = { 49 | # webexercises::fitb(answer = q[1], tol = 0) 50 | # })}) 51 | # 52 | # txt <- paste0( 53 | # intro, 54 | # paste(paste(names(dots), questions), collapse = "\n\n"), 55 | # outro 56 | # ) 57 | # } else { 58 | # txt = "" 59 | # } 60 | # cat(txt) 61 | # } 62 | # } 63 | -------------------------------------------------------------------------------- /R/worcs_checklist.R: -------------------------------------------------------------------------------- 1 | #' WORCS checklist 2 | #' 3 | #' This checklist can be used to see whether a project adheres to the principles 4 | #' of open reproducible code in science, as set out in the WORCS paper. 5 | #' 6 | #' \tabular{lll}{ 7 | #' \strong{category} \tab \code{factor} \tab Category of the checklist 8 | #' element.\cr 9 | #' \strong{name} \tab \code{factor} \tab Name of the checklist 10 | #' element.\cr 11 | #' \strong{description} \tab \code{factor} \tab What are the requirements 12 | #' to claim that this checklist element is met?\cr 13 | #' \strong{importance} \tab \code{factor} \tab Whether the checklist 14 | #' element is essential to obtain a green 'open science' badge, or optional.\cr 15 | #' \strong{check} \tab \code{logical} \tab Whether the criterion is checked 16 | #' automatically by \code{\link{worcs_badge}}. 17 | #' } 18 | #' @docType data 19 | #' @keywords datasets 20 | #' @name worcs_checklist 21 | #' @usage data(worcs_checklist) 22 | #' @references Van Lissa, C. J., Brandmaier, A. M., Brinkman, L., Lamprecht, A., 23 | #' Peikert, A., , Struiksma, M. E., & Vreede, B. (2021) 24 | #' \doi{10.3233/DS-210031}. 25 | # 26 | #' @format A data frame with 15 rows and 5 variables. 27 | NULL 28 | -------------------------------------------------------------------------------- /R/worcs_file.R: -------------------------------------------------------------------------------- 1 | # write_worcsfile(filename = ".worcs", 2 | # worcs_version = "0.1.1", 3 | # creator = Sys.info()["effective_user"], 4 | # checksums = list(ckone = "1334", cktwo = "5y54") 5 | # ) 6 | #' @importFrom yaml write_yaml read_yaml 7 | write_worcsfile <- function(filename, ..., modify = FALSE){ 8 | new_contents <- list(...) 9 | if(modify & file.exists(filename)){ 10 | old_contents <- read_yaml(filename) 11 | new_contents <- mod_nested_list(old_contents, new_contents) 12 | } 13 | write_yaml(new_contents, filename) 14 | } 15 | 16 | mod_nested_list <- function(old, new){ 17 | if(is.null(old)){ 18 | return(new) 19 | } 20 | for(i in 1:length(new)){ 21 | if(depth(new[i]) == 1){ 22 | if(names(new)[i] %in% names(old)){ 23 | old[names(new)[i]] <- new[i] 24 | } else { 25 | old <- c(old, new[i]) 26 | } 27 | } else { 28 | old[[names(new)[i]]] <- mod_nested_list(old[[names(new)[i]]], new[[i]]) 29 | } 30 | } 31 | old 32 | } 33 | 34 | depth <- function(this,thisdepth=0){ 35 | if((!is.list(this))|length(this) == 0){ 36 | return(thisdepth) 37 | }else{ 38 | return(max(unlist(lapply(this,depth,thisdepth=thisdepth+1)))) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | #' @importFrom rlang inform 2 | #' @importFrom cli format_inline 3 | greet_startup <- function() { 4 | msg <- "Welcome to WORCS: Workflow for Open Reproducible Code in Science. Run {.code check_worcs_installation()} to make sure all dependencies are installed. For more information, see the {.href [package vignettes](https://cjvanlissa.github.io/worcs/articles)} and accompanying paper: {.href [Van Lissa and colleagues (2020)](https://doi.org/10.3233/DS-210031)}" 5 | rlang::inform(cli::format_inline(msg), class = "packageStartupMessage") 6 | } 7 | 8 | # @importFrom rstudioapi versionInfo 9 | .onAttach <- function(libname, pkgname) { 10 | greet_startup() 11 | } 12 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://cjvanlissa.github.io/worcs/ 2 | template: 3 | bootstrap: 5 4 | include: 5 | after_body: 6 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | informational: true 10 | patch: 11 | default: 12 | target: auto 13 | threshold: 1% 14 | informational: true 15 | -------------------------------------------------------------------------------- /collab/minutes_08-05-2020.md: -------------------------------------------------------------------------------- 1 | # Introductions 2 | 3 | AB: Andreas Brandmaier 4 | AP: Aaron Peikert 5 | CJ: Caspar van Lissa 6 | 7 | # Mission statements for our projects 8 | 9 | WORCS: 10 | * One-click solution to get everything set up on YOUR SYSTEM for a project that meets all TOP/FAIR requirements for Open Science 11 | * Minimal effort, just good enough 12 | 13 | REPRO: 14 | * Start from the goal of strict reproducibility, then work to make it more and more userfriendly 15 | * Has a one click solution, like worcs 16 | * Also has use_this type solution 17 | * Checks for dependencies and recommendations on how to install them (see: has_git() in worcs?) 18 | * automate commands: yaml headers for what data and scripts they need 19 | * make file linked to Build button to run entire project 20 | 21 | # How do these packages relate to each other 22 | 23 | worcs interfacing with REPRO: 24 | * CJ 25 | - Picking up that project and dropping it into a time capsule 26 | - I think people are likely to move from worcs to repro 27 | - I think it's less likely that people will move the other way 28 | * AP: 29 | - People should start with worcs (should be standard) 30 | - Not ideal to switch package 31 | - Move internals to repro in modular fashion 32 | 33 | ## Roadmap for repro/worcs interface 34 | 35 | 1. Modularize worcs 36 | 2. Absorb into repro 37 | 3. Make worcs package depend on repro and be a "facade" for it 38 | 39 | # Next steps 40 | 41 | * Prepare codebook for compatibility with user-defined description, and machine-readable variable categories (talk with Frank Bosco from MetaBUS) 42 | * remove git dependency (CJ: Perhaps I disagree... git is pretty essential to a reproducible workflow) 43 | * redoc for collaborators 44 | * Use intall (the package) instead of remotes 45 | 46 | Troubleshooting: 47 | * ZIP: Aaron has linux, install zip lib on travis 48 | * Tests - failing, cleanup examples 49 | * Icon, great idea 50 | 51 | # Logistics of Collaboration 52 | * Feel free to make minor bug fixes in eachother's packages 53 | * Please debug your own functions and add tests 54 | * Reciprocal contributions 55 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | # worcs 0.1.18 2 | 3 | * Add list_endpoints() and remove_endpoint() 4 | * Bugfix checksum function 5 | * Clean up examples in function documentation 6 | * By default, mute status messages in non-interactive contexts 7 | * Bugfix check_dependencies() 8 | 9 | ## R CMD check results 10 | 11 | 0 errors | 0 warnings | 0 notes 12 | 13 | ## Test environments 14 | 15 | * local Windows 11, R 4.3.2 16 | * win-builder: R version 4.4.2 (2024-10-31 ucrt) 17 | * win-builder: R Under development (unstable) (2024-12-30 r87496 ucrt) 18 | * win-builder: R version 4.3.3 (2024-02-29 ucrt) 19 | * Rhub: linux (R-devel) 20 | * Rhub: macos (R-devel) 21 | * Rhub: macos-arm64 (R-devel) 22 | * Rhub: windows (R-devel) 23 | * GitHub Actions: macos-latest (release) 24 | * GitHub Actions: windows-latest (release) 25 | * GitHub Actions: ubuntu-latest (devel) 26 | * GitHub Actions: ubuntu-latest (release) 27 | * GitHub Actions: ubuntu-latest (oldrel-1) 28 | 29 | -------------------------------------------------------------------------------- /data/worcs_checklist.csv: -------------------------------------------------------------------------------- 1 | "category";"name";"description";"importance";"check" 2 | "documentation";"readme";"Does the project have a README.md file?";"essential";TRUE 3 | "documentation";"license";"Does the project have a LICENSE file?";"essential";TRUE 4 | "citation";"citation";"Does the project cite any references in 'manuscript.Rmd' or 'preregistration.Rmd'?";"optional";TRUE 5 | "citation";"comprehensive";"Does the project cite all literature, data sources, materials, and methods (including R-packages) used?";"optional";FALSE 6 | "data";"data";"Does the project have a public* 'data.csv' or 'synthetic_data.csv' file? (*public: version controlled in 'Git')";"essential";TRUE 7 | "data";"data_checksums";"Are the data checksums up to date?";"essential";TRUE 8 | "code";"code";"Does the project contain any '.R' code files?";"essential";TRUE 9 | "code";"code_reproducible";"Can the entire project be reproduced by running a single file (e.g.,'manuscript.Rmd', 'run_me.R', or a Makefile)?";"optional";FALSE 10 | "materials";"materials";"Any new materials are shared openly; existing materials are referenced.";"optional";FALSE 11 | "design";"design";"Details of the study design are documented.";"essential";FALSE 12 | "analysis";"analysis";"Details of the analysis are documented.";"essential";FALSE 13 | "preregistration";"preregistration";"Does the project have a preregistration?";"optional";TRUE 14 | "preregistration";"prereg_analysis";"Does the preregistration contain detailed analysis plans or preliminary code?";"optional";FALSE 15 | "git";"git_repo";"Does the project have a 'Git' repository?";"essential";TRUE 16 | "git";"has_remote";"Is the 'Git' repository connected to a remote repository (e.g., 'GitHub')?";"essential";TRUE 17 | -------------------------------------------------------------------------------- /docs/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /docs/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/articles/citation_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/citation_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/git_cloud_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/git_cloud_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/github_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/articles/github_download.png -------------------------------------------------------------------------------- /docs/articles/reproduce_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/reproduce_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/scholar_bib.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/articles/scholar_bib.png -------------------------------------------------------------------------------- /docs/articles/setup-docker_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/setup-docker_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/setup_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/setup_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/articles/workflow.png -------------------------------------------------------------------------------- /docs/articles/workflow_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/workflow_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v1.0.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | !function(a){"use strict";window.Toc={helpers:{findOrFilter:function(e,t){var n=e.find(t);return e.filter(t).add(n).filter(":not([data-toc-skip])")},generateUniqueIdBase:function(e){return a(e).text().trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,64).replace(/^-+|-+$/gm,"").toLowerCase()||e.tagName.toLowerCase()},generateUniqueId:function(e){for(var t=this.generateUniqueIdBase(e),n=0;;n++){var r=t;if(0')},createChildNavList:function(e){var t=this.createNavList();return e.append(t),t},generateNavEl:function(e,t){var n=a('');n.attr("href","#"+e),n.text(t);var r=a("
  • ");return r.append(n),r},generateNavItem:function(e){var t=this.generateAnchor(e),n=a(e),r=n.data("toc-text")||n.text();return this.generateNavEl(t,r)},getTopLevel:function(e){for(var t=1;t<=6;t++){if(1 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.woff2 -------------------------------------------------------------------------------- /docs/deps/headroom-0.11.0/jQuery.headroom.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * headroom.js v0.9.4 - Give your page some headroom. Hide your header until you need it 3 | * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/headroom.js 4 | * License: MIT 5 | */ 6 | 7 | !function(a){a&&(a.fn.headroom=function(b){return this.each(function(){var c=a(this),d=c.data("headroom"),e="object"==typeof b&&b;e=a.extend(!0,{},Headroom.options,e),d||(d=new Headroom(this,e),d.init(),c.data("headroom",d)),"string"==typeof b&&(d[b](),"destroy"===b&&c.removeData("headroom"))})},a("[data-headroom]").each(function(){var b=a(this);b.headroom(b.data())}))}(window.Zepto||window.jQuery); -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/favicon-16x16.png -------------------------------------------------------------------------------- /docs/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/favicon-32x32.png -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/favicon.ico -------------------------------------------------------------------------------- /docs/katex-auto.js: -------------------------------------------------------------------------------- 1 | // https://github.com/jgm/pandoc/blob/29fa97ab96b8e2d62d48326e1b949a71dc41f47a/src/Text/Pandoc/Writers/HTML.hs#L332-L345 2 | document.addEventListener("DOMContentLoaded", function () { 3 | var mathElements = document.getElementsByClassName("math"); 4 | var macros = []; 5 | for (var i = 0; i < mathElements.length; i++) { 6 | var texText = mathElements[i].firstChild; 7 | if (mathElements[i].tagName == "SPAN") { 8 | katex.render(texText.data, mathElements[i], { 9 | displayMode: mathElements[i].classList.contains("display"), 10 | throwOnError: false, 11 | macros: macros, 12 | fleqn: false 13 | }); 14 | }}}); 15 | -------------------------------------------------------------------------------- /docs/lightswitch.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/) 4 | * Copyright 2011-2023 The Bootstrap Authors 5 | * Licensed under the Creative Commons Attribution 3.0 Unported License. 6 | * Updates for {pkgdown} by the {bslib} authors, also licensed under CC-BY-3.0. 7 | */ 8 | 9 | const getStoredTheme = () => localStorage.getItem('theme') 10 | const setStoredTheme = theme => localStorage.setItem('theme', theme) 11 | 12 | const getPreferredTheme = () => { 13 | const storedTheme = getStoredTheme() 14 | if (storedTheme) { 15 | return storedTheme 16 | } 17 | 18 | return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' 19 | } 20 | 21 | const setTheme = theme => { 22 | if (theme === 'auto') { 23 | document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')) 24 | } else { 25 | document.documentElement.setAttribute('data-bs-theme', theme) 26 | } 27 | } 28 | 29 | function bsSetupThemeToggle () { 30 | 'use strict' 31 | 32 | const showActiveTheme = (theme, focus = false) => { 33 | var activeLabel, activeIcon; 34 | 35 | document.querySelectorAll('[data-bs-theme-value]').forEach(element => { 36 | const buttonTheme = element.getAttribute('data-bs-theme-value') 37 | const isActive = buttonTheme == theme 38 | 39 | element.classList.toggle('active', isActive) 40 | element.setAttribute('aria-pressed', isActive) 41 | 42 | if (isActive) { 43 | activeLabel = element.textContent; 44 | activeIcon = element.querySelector('span').classList.value; 45 | } 46 | }) 47 | 48 | const themeSwitcher = document.querySelector('#dropdown-lightswitch') 49 | if (!themeSwitcher) { 50 | return 51 | } 52 | 53 | themeSwitcher.setAttribute('aria-label', activeLabel) 54 | themeSwitcher.querySelector('span').classList.value = activeIcon; 55 | 56 | if (focus) { 57 | themeSwitcher.focus() 58 | } 59 | } 60 | 61 | window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => { 62 | const storedTheme = getStoredTheme() 63 | if (storedTheme !== 'light' && storedTheme !== 'dark') { 64 | setTheme(getPreferredTheme()) 65 | } 66 | }) 67 | 68 | window.addEventListener('DOMContentLoaded', () => { 69 | showActiveTheme(getPreferredTheme()) 70 | 71 | document 72 | .querySelectorAll('[data-bs-theme-value]') 73 | .forEach(toggle => { 74 | toggle.addEventListener('click', () => { 75 | const theme = toggle.getAttribute('data-bs-theme-value') 76 | setTheme(theme) 77 | setStoredTheme(theme) 78 | showActiveTheme(theme, true) 79 | }) 80 | }) 81 | }) 82 | } 83 | 84 | setTheme(getPreferredTheme()); 85 | bsSetupThemeToggle(); 86 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/logo.png -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: '3.2' 2 | pkgdown: 2.1.1 3 | pkgdown_sha: ~ 4 | articles: 5 | citation: citation.html 6 | endpoints: endpoints.html 7 | git_cloud: git_cloud.html 8 | reproduce: reproduce.html 9 | setup-docker: setup-docker.html 10 | setup: setup.html 11 | synthetic_data: synthetic_data.html 12 | targets: targets.html 13 | workflow: workflow.html 14 | last_built: 2025-03-05T11:12Z 15 | urls: 16 | reference: https://cjvanlissa.github.io/worcs/reference 17 | article: https://cjvanlissa.github.io/worcs/articles 18 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/check_dependencies.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/check_git.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/check_github.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/check_renv.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/check_rmarkdown.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/check_ssh.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/check_tinytext.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/citeall.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Untitled" 3 | output: github_document 4 | --- 5 | 6 | ```{r setup, include=FALSE} 7 | knitr::opts_chunk$set(echo = TRUE) 8 | ``` 9 | 10 | ## GitHub Documents 11 | 12 | This is an R Markdown format used for publishing markdown documents to GitHub. When you click the **Knit** button all R code chunks are run and a markdown file (.md) suitable for publishing to GitHub is generated. 13 | 14 | ## Including Code 15 | 16 | You can include R code in the document as follows: 17 | 18 | ```{r cars} 19 | summary(cars) 20 | ``` 21 | 22 | ## Including Plots 23 | 24 | You can also embed plots, for example: 25 | 26 | ```{r pressure, echo=FALSE} 27 | plot(pressure) 28 | ``` 29 | 30 | Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot. 31 | 32 | Optional reference: @reference2020 33 | -------------------------------------------------------------------------------- /docs/reference/citeall.md: -------------------------------------------------------------------------------- 1 | Untitled 2 | ================ 3 | 4 | ## GitHub Documents 5 | 6 | This is an R Markdown format used for publishing markdown documents to 7 | GitHub. When you click the **Knit** button all R code chunks are run and 8 | a markdown file (.md) suitable for publishing to GitHub is generated. 9 | 10 | ## Including Code 11 | 12 | You can include R code in the document as follows: 13 | 14 | ``` r 15 | summary(cars) 16 | ``` 17 | 18 | ## speed dist 19 | ## Min. : 4.0 Min. : 2.00 20 | ## 1st Qu.:12.0 1st Qu.: 26.00 21 | ## Median :15.0 Median : 36.00 22 | ## Mean :15.4 Mean : 42.98 23 | ## 3rd Qu.:19.0 3rd Qu.: 56.00 24 | ## Max. :25.0 Max. :120.00 25 | 26 | ## Including Plots 27 | 28 | You can also embed plots, for example: 29 | 30 | ![](citeall_files/figure-gfm/pressure-1.png) 31 | 32 | Note that the `echo = FALSE` parameter was added to the code chunk to 33 | prevent printing of the R code that generated the plot. 34 | 35 | Optional reference: @reference2020 36 | -------------------------------------------------------------------------------- /docs/reference/citeall_files/figure-gfm/pressure-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/reference/citeall_files/figure-gfm/pressure-1.png -------------------------------------------------------------------------------- /docs/reference/citeessential6dfc21a823d7.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Untitled" 3 | output: github_document 4 | --- 5 | 6 | ```{r setup, include=FALSE} 7 | knitr::opts_chunk$set(echo = TRUE) 8 | ``` 9 | 10 | ## GitHub Documents 11 | 12 | This is an R Markdown format used for publishing markdown documents to GitHub. When you click the **Knit** button all R code chunks are run and a markdown file (.md) suitable for publishing to GitHub is generated. 13 | 14 | ## Including Code 15 | 16 | You can include R code in the document as follows: 17 | 18 | ```{r cars} 19 | summary(cars) 20 | ``` 21 | 22 | ## Including Plots 23 | 24 | You can also embed plots, for example: 25 | 26 | ```{r pressure, echo=FALSE} 27 | plot(pressure) 28 | ``` 29 | 30 | Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot. 31 | 32 | Optional reference: @reference2020 33 | -------------------------------------------------------------------------------- /docs/reference/citeessential6dfc21a823d7.md: -------------------------------------------------------------------------------- 1 | Untitled 2 | ================ 3 | 4 | ## GitHub Documents 5 | 6 | This is an R Markdown format used for publishing markdown documents to 7 | GitHub. When you click the **Knit** button all R code chunks are run and 8 | a markdown file (.md) suitable for publishing to GitHub is generated. 9 | 10 | ## Including Code 11 | 12 | You can include R code in the document as follows: 13 | 14 | ``` r 15 | summary(cars) 16 | ``` 17 | 18 | ## speed dist 19 | ## Min. : 4.0 Min. : 2.00 20 | ## 1st Qu.:12.0 1st Qu.: 26.00 21 | ## Median :15.0 Median : 36.00 22 | ## Mean :15.4 Mean : 42.98 23 | ## 3rd Qu.:19.0 3rd Qu.: 56.00 24 | ## Max. :25.0 Max. :120.00 25 | 26 | ## Including Plots 27 | 28 | You can also embed plots, for example: 29 | 30 | ![](citeessential6dfc21a823d7_files/figure-gfm/pressure-1.png) 31 | 32 | Note that the `echo = FALSE` parameter was added to the code chunk to 33 | prevent printing of the R code that generated the plot. 34 | 35 | Optional reference: @reference2020 36 | -------------------------------------------------------------------------------- /docs/reference/citeessential6dfc21a823d7_files/figure-gfm/pressure-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/reference/citeessential6dfc21a823d7_files/figure-gfm/pressure-1.png -------------------------------------------------------------------------------- /docs/reference/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/docs/reference/figures/logo.png -------------------------------------------------------------------------------- /docs/reference/git_release_publish.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/github_action_reproduce.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /inst/rstudio/addins.dcf: -------------------------------------------------------------------------------- 1 | Name: Export to zip 2 | Description: Exports the current project to a single zip file. 3 | Binding: export_project 4 | Interactive: false -------------------------------------------------------------------------------- /inst/rstudio/templates/project/resources/README.md: -------------------------------------------------------------------------------- 1 | # Readme 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ## Where do I start? 12 | 13 | You can load this project in RStudio by opening the file called 14 | 15 | ## Project structure 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | # Reproducibility 26 | 27 | This project uses the Workflow for Open Reproducible Code in Science (WORCS) to 28 | ensure transparency and reproducibility. The workflow is designed to meet the 29 | principles of Open Science throughout a research project. 30 | 31 | To learn how WORCS helps researchers meet the TOP-guidelines and FAIR principles, 32 | read the preprint at https://osf.io/zcvbs/ 33 | 34 | ## WORCS: Advice for authors 35 | 36 | * To get started with `worcs`, see the [setup vignette](https://cjvanlissa.github.io/worcs/articles/setup.html) 37 | * For detailed information about the steps of the WORCS workflow, see the [workflow vignette](https://cjvanlissa.github.io/worcs/articles/workflow.html) 38 | 39 | ## WORCS: Advice for readers 40 | 41 | Please refer to the vignette on [reproducing a WORCS project]() for step by step advice. 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /inst/rstudio/templates/project/resources/_targets.rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Target Markdown" 3 | output: html_document 4 | --- 5 | 6 | ```{r setup, include = FALSE} 7 | knitr::opts_chunk$set(collapse = TRUE, comment = "#>") 8 | ``` 9 | 10 | Target Markdown is a powerful R Markdown interface for reproducible analysis pipelines, and the chapter at https://books.ropensci.org/targets/markdown.html walks through it in detail. This R Markdown report the example from the chapter. Try it out in both interactive and non-interactive modes, either by running the code chunks in different ways or setting the `tar_interactive` chunk option. 11 | 12 | # Setup 13 | 14 | If you are using old versions of `targets` (<= 0.7.0) and/or `knitr` (<= 1.33), you will need to load the `targets` package in the R Markdown document in order for Target Markdown code chunks to work. 15 | 16 | ```{r} 17 | library(targets) 18 | ``` 19 | 20 | Near the top of the document, you may also wish to remove the `_targets_r` directory previously written by non-interactive runs of the report. Otherwise, your pipeline may contain superfluous targets. 21 | 22 | ```{r} 23 | library(targets) 24 | tar_unscript() 25 | ``` 26 | 27 | # Targets 28 | 29 | Our first target borrows the `airquality` dataset built into base R. 30 | 31 | ```{targets raw-data} 32 | tar_target(raw_data, airquality) 33 | ``` 34 | 35 | Our next targets preprocess the data, make a histogram, and fit a model. 36 | 37 | ```{targets downstream-targets} 38 | list( 39 | tar_target(data, {raw_data[complete.cases(airquality), ]}), 40 | tar_target(hist, hist(data$Ozone)) 41 | ) 42 | ``` 43 | 44 | Set the `tar_simple` chunk option to `TRUE` to define a single target with the command in the code chunk. The chunk below only contains `biglm(Ozone ~ Wind + Temp, data)` in the source, but because `tar_simple` is `TRUE`, it is shorthand for `tar_target(name = fit, command = biglm(Ozone ~ Wind + Temp, data))`. All other arguments to `tar_target()` are set to their default values (configurable with `tar_option_set()`). 45 | 46 | ```{targets fit, tar_simple = TRUE} 47 | lm(Ozone ~ Wind + Temp, data) 48 | ``` 49 | 50 | # Pipeline 51 | 52 | If you ran all the `{targets}` chunks in non-interactive mode, then your R scripts are set up to run the pipeline. 53 | 54 | ```{r} 55 | tar_make() 56 | ``` 57 | 58 | # Output 59 | 60 | You can retrieve results from the `_targets/` data store using `tar_read()` or `tar_load()`. 61 | 62 | ```{r, message = FALSE} 63 | tar_read(fit) 64 | ``` 65 | 66 | ```{r} 67 | tar_read(hist) 68 | ``` 69 | 70 | 71 | At this point, you can go back and run `{targets}` chunks in interactive mode without interfering with the code or data of the non-interactive pipeline. 72 | -------------------------------------------------------------------------------- /inst/rstudio/templates/project/resources/prepare_data.R: -------------------------------------------------------------------------------- 1 | # In this file, write the R-code necessary to load your original data file 2 | # (e.g., an SPSS, Excel, or SAS-file), and convert it to a data.frame. Then, 3 | # use the function open_data(your_data_frame) or closed_data(your_data_frame) 4 | # to store the data. 5 | 6 | library(worcs) 7 | -------------------------------------------------------------------------------- /inst/rstudio/templates/project/resources/pss.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Title here" 3 | shorttitle : "Short title here" 4 | date : "`r Sys.setlocale('LC_TIME', 'C'); format(Sys.time(), '%d\\\\. %B %Y')`" 5 | authors : "Author names here" 6 | --- 7 | 8 | 16 | 17 | # Title 18 | 19 | 20 | 21 | ## Authors 22 | 23 | 24 | 25 | ## Affiliations 26 | 27 | 28 | 29 | # Background of the study 30 | 31 | ## Primary study/Secondary analyses 32 | 33 | 35 | 36 | ## Does the study refer to a meta-analysis? 37 | 38 | 41 | 42 | ## Research questions 43 | 44 | 45 | 46 | ## Study hypotheses 47 | 48 | 49 | 50 | # Method 51 | 52 | ## Stimuli 53 | 54 | 55 | 56 | 57 | ## Questionnaires 58 | 59 | 60 | 61 | ## Equipment 62 | 63 | 64 | 65 | ## Procedure 66 | 67 | 68 | 69 | ## Protocol 70 | 71 | 72 | 73 | # Statistical analyses 74 | 75 | ## Participants 76 | 77 | 79 | 80 | ## Stopping rule 81 | 82 | 83 | 84 | ## Confirming hypotheses threshold 85 | 86 | 87 | 88 | ## Disconfirming hypotheses threshold 89 | 90 | 91 | 92 | # Other 93 | 94 | ## Other (Optional) 95 | 96 | 97 | 98 | # References 99 | 100 | 101 | 102 | ## 103 | \vspace{-2pc} 104 | \setlength{\parindent}{-0.5in} 105 | \setlength{\leftskip}{-1in} 106 | \setlength{\parskip}{8pt} 107 | \noindent 108 | -------------------------------------------------------------------------------- /inst/rstudio/templates/project/resources/references.bib: -------------------------------------------------------------------------------- 1 | 2 | @article{vanlissaWORCSWorkflowOpen2021, 3 | title = {{{WORCS}}: {{A}} Workflow for Open Reproducible Code in Science}, 4 | author = {Van Lissa, Caspar J. and Brandmaier, Andreas M. and Brinkman, Loek and Lamprecht, Anna-Lena and Peikert, Aaron and Struiksma, Marijn E. and Vreede, Barbara M.I.}, 5 | year = {2021}, 6 | journal = {Data Science}, 7 | volume = {4}, 8 | number = {1}, 9 | pages = {29--49}, 10 | publisher = {{IOS Press}}, 11 | issn = {2451-8492}, 12 | doi = {10.3233/DS-210031}, 13 | abstract = {Adopting open science principles can be challenging, requiring conceptual education and training in the use of new tools. This paper introduces the Workflow for Open Reproducible Code in Science (WORCS): A step-by-step procedure that researchers can follow to make a research project open and reproducible. This workflow intends to lower the threshold for adoption of open science principles. It is based on established best practices, and can be used either in parallel to, or in absence of, top-down requirements by journals, institutions, and funding bodies. To facilitate widespread adoption, the WORCS principles have been implemented in the R package worcs , which offers an RStudio project template and utility functions for specific workflow steps. This paper introduces the conceptual workflow, discusses how it meets different standards for open science, and addresses the functionality provided by the R implementation, worcs . This paper is primarily targeted towards scholars conducting research projects in R, conducting research that involves academic prose, analysis code, and tabular data. However, the workflow is flexible enough to accommodate other scenarios, and offers a starting point for customized solutions. The source code for the R package and manuscript, and a list of examplesof WORCS projects , are available at https://github.com/cjvanlissa/worcs .}, 14 | keywords = {dynamic document generation,Open science,r,reproducibility,version control} 15 | } 16 | 17 | -------------------------------------------------------------------------------- /inst/rstudio/templates/project/resources/worcs_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/inst/rstudio/templates/project/resources/worcs_icon.png -------------------------------------------------------------------------------- /inst/rstudio/templates/project/worcs.dcf: -------------------------------------------------------------------------------- 1 | Binding: worcs_project 2 | Title: WORCS project template 3 | OpenFiles: README.md, manuscript/manuscript.Rmd, preregistration.Rmd, prepare_data.R 4 | Icon: worcs.png 5 | 6 | Parameter: remote_repo 7 | Widget: TextInput 8 | Label: GitHub remote URL or name 9 | Default: https://... .git 10 | 11 | Parameter: use_renv 12 | Widget: CheckboxInput 13 | Label: Use renv 14 | Default: On 15 | Position: right 16 | 17 | Parameter: use_targets 18 | Widget: CheckboxInput 19 | Label: Use targets 20 | Default: Off 21 | Position: right 22 | 23 | Parameter: manuscript 24 | Widget: SelectInput 25 | Label: Manuscript template 26 | Fields: github_document, APA6, None, target_markdown, acm_article, acs_article, aea_article, agu_article, ajs_article, amq_article, ams_article, arxiv_article, asa_article, bioinformatics_article, biometrics_article, copernicus_article, ctex_article, elsevier_article, frontiers_article, glossa_article, ieee_article, ims_article, informs_article, iop_article, isba_article, jasa_article, jedm_article, joss_article, jss_article, lipics_article, lncs_article, mdpi_article, mnras_article, oup_article, peerj_article, pihph_article, plos_article, pnas_article, rjournal_article, rsos_article, rss_article, sage_article, sim_article, springer_article, tf_article, trb_article, wellcomeor_article 27 | 28 | Parameter: preregistration 29 | Widget: SelectInput 30 | Label: Preregistration template 31 | Fields: None, PSS, Secondary, aspredicted_prereg, brandt_prereg, cos_prereg, fmri_prereg, prp_quant_prereg, psyquant_prereg, rr_prereg, vantveer_prereg 32 | 33 | Parameter: add_license 34 | Widget: SelectInput 35 | Label: Use license 36 | Fields: cc0, ccby, gpl, gpl3, agpl, agpl3, apache, apl2, lgpl, mit, proprietary, None 37 | -------------------------------------------------------------------------------- /inst/rstudio/templates/project/worcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/inst/rstudio/templates/project/worcs.png -------------------------------------------------------------------------------- /man/add_endpoint.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/endpoint.R 3 | \name{add_endpoint} 4 | \alias{add_endpoint} 5 | \title{Add endpoint to WORCS project} 6 | \usage{ 7 | add_endpoint(filename = NULL, worcs_directory = ".", verbose = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{filename}{Character, indicating the file to be tracked as endpoint. 11 | Default: NULL.} 12 | 13 | \item{worcs_directory}{Character, indicating the WORCS project directory 14 | to which to save data. The default value "." points to the current directory. 15 | Default: '.'} 16 | 17 | \item{verbose}{Logical. Whether or not to print status messages to the 18 | console. Default: TRUE} 19 | 20 | \item{...}{Additional arguments.} 21 | } 22 | \value{ 23 | No return value. This function is called for its side effects. 24 | } 25 | \description{ 26 | Add a specific endpoint to the WORCS project file. Endpoints are 27 | files that are expected to be exactly reproducible (e.g., a manuscript, 28 | figure, table, et cetera). Reproducibility is checked by ensuring the 29 | endpoint's checksum is unchanged. 30 | } 31 | \examples{ 32 | # Create directory to run the example 33 | old_wd <- getwd() 34 | test_dir <- file.path(tempdir(), "add_endpoint") 35 | dir.create(test_dir) 36 | setwd(test_dir) 37 | file.create(".worcs") 38 | writeLines("test", "test.txt") 39 | add_endpoint("test.txt") 40 | # Cleaning example directory 41 | setwd(old_wd) 42 | unlink(test_dir, recursive = TRUE) 43 | } 44 | \seealso{ 45 | \code{\link[worcs]{snapshot_endpoints}} 46 | \code{\link[worcs]{check_endpoints}} 47 | } 48 | -------------------------------------------------------------------------------- /man/add_license_file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/licenses.R 3 | \name{add_license_file} 4 | \alias{add_license_file} 5 | \title{Add License File to Project} 6 | \usage{ 7 | add_license_file(path = ".", license = "ccby", ...) 8 | } 9 | \arguments{ 10 | \item{path}{Character, indicating the directory in which to create the 11 | license file. Default: '.'.} 12 | 13 | \item{license}{Character, indicating which license function to call. 14 | The \code{usethis} functions all have the form \verb{use_\{licensename\}_license()}. 15 | The \code{license} argument consists only of the \code{{licensename}}, e.g. \code{ccby}.} 16 | 17 | \item{...}{Additional arguments passed to \code{usethis} function.} 18 | } 19 | \value{ 20 | No return value. This function is called for its side effects. 21 | } 22 | \description{ 23 | This function wraps \code{usethis}' 24 | \code{\link[usethis:licenses]{licenses}} functions, which are 25 | designed for R-packages. This function makes them applicable to other use 26 | cases (e.g., WORCS projects, FAIR theory). 27 | } 28 | \examples{ 29 | if(requireNamespace("withr", quietly = TRUE)){ 30 | withr::with_tempdir({ 31 | add_license_file(path = ".", 32 | license = "proprietary", 33 | copyright_holder = "test") 34 | }) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /man/add_preregistration.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/worcs_project.R 3 | \name{add_preregistration} 4 | \alias{add_preregistration} 5 | \title{Add Rmarkdown preregistration} 6 | \usage{ 7 | add_preregistration( 8 | worcs_directory = ".", 9 | preregistration = "cos_prereg", 10 | verbose = TRUE, 11 | ... 12 | ) 13 | } 14 | \arguments{ 15 | \item{worcs_directory}{Character, indicating the directory 16 | in which to create the manuscript files. Default: '.', which points to the 17 | current working directory.} 18 | 19 | \item{preregistration}{Character, indicating what template to use for the 20 | preregistration. Default: \code{"cos_prereg"}; use \code{"None"} to omit a 21 | preregistration. See Details for other available choices.} 22 | 23 | \item{verbose}{Logical. Whether or not to print messages to the console 24 | during project creation. Default: TRUE} 25 | 26 | \item{...}{Additional arguments passed to and from functions.} 27 | } 28 | \value{ 29 | No return value. This function is called for its side effects. 30 | } 31 | \description{ 32 | Adds an Rmarkdown preregistration template to a 'worcs' project. 33 | } 34 | \details{ 35 | Available choices include the templates from the 36 | \code{\link[prereg:prereg]{prereg}} package, and several unique templates 37 | included with \code{worcs}: 38 | \describe{ 39 | \item{\code{'PSS'}}{Preregistration and Sharing Software (Krypotos, 40 | Klugkist, Mertens, & Engelhard, 2019)} 41 | \item{\code{'Secondary'}}{Preregistration for secondary analyses (Mertens & 42 | Krypotos, 2019)} 43 | \item{\code{'aspredicted_prereg'}}{aspredicted template from the \code{prereg} package} 44 | \item{\code{'brandt_prereg'}}{brandt template from the \code{prereg} package} 45 | \item{\code{'cos_prereg'}}{cos template from the \code{prereg} package} 46 | \item{\code{'fmri_prereg'}}{fmri template from the \code{prereg} package} 47 | \item{\code{'prp_quant_prereg'}}{prp_quant template from the \code{prereg} package} 48 | \item{\code{'psyquant_prereg'}}{psyquant template from the \code{prereg} package} 49 | \item{\code{'rr_prereg'}}{rr template from the \code{prereg} package} 50 | \item{\code{'vantveer_prereg'}}{vantveer template from the \code{prereg} package} 51 | } 52 | } 53 | \examples{ 54 | the_test <- "worcs_prereg" 55 | old_wd <- getwd() 56 | dir.create(file.path(tempdir(), the_test)) 57 | file.create(file.path(tempdir(), the_test, ".worcs")) 58 | add_preregistration(file.path(tempdir(), the_test), 59 | preregistration = "cos_prereg") 60 | setwd(old_wd) 61 | unlink(file.path(tempdir(), the_test)) 62 | } 63 | -------------------------------------------------------------------------------- /man/add_recipe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/recipes.R 3 | \name{add_recipe} 4 | \alias{add_recipe} 5 | \title{Add Recipe to Generate Endpoints} 6 | \usage{ 7 | add_recipe( 8 | worcs_directory = ".", 9 | recipe = "rmarkdown::render('manuscript/manuscript.Rmd')", 10 | terminal = FALSE, 11 | verbose = TRUE, 12 | ... 13 | ) 14 | } 15 | \arguments{ 16 | \item{worcs_directory}{Character, indicating the WORCS project directory 17 | to which to save data. The default value "." points to the current directory. 18 | Default: '.'} 19 | 20 | \item{recipe}{Character string, indicating the function call to evaluate in 21 | order to reproduce the endpoints of the WORCS project.} 22 | 23 | \item{terminal}{Logical, indicating whether or not to evaluate the \code{recipe} 24 | in the terminal (\code{TRUE}) or in R (\code{FALSE}). Defaults to \code{FALSE}} 25 | 26 | \item{verbose}{Logical. Whether or not to print status messages to the 27 | console. Default: \code{TRUE}} 28 | 29 | \item{...}{Additional arguments.} 30 | } 31 | \value{ 32 | No return value. This function is called for its side effects. 33 | } 34 | \description{ 35 | Add a recipe to a WORCS project file to generate its endpoints. 36 | } 37 | \examples{ 38 | # Create directory to run the example 39 | if(requireNamespace("withr", quietly = TRUE)){ 40 | withr::with_tempdir({ 41 | file.create(".worcs") 42 | writeLines("test", "test.txt") 43 | add_recipe() 44 | }) 45 | } 46 | } 47 | \seealso{ 48 | \code{\link[worcs]{add_endpoint}} 49 | \code{\link[worcs]{snapshot_endpoints}} 50 | \code{\link[worcs]{check_endpoints}} 51 | } 52 | -------------------------------------------------------------------------------- /man/add_synthetic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/add_synthetic.R 3 | \name{add_synthetic} 4 | \alias{add_synthetic} 5 | \title{Add synthetic data to WORCS project} 6 | \usage{ 7 | add_synthetic( 8 | data, 9 | synthetic_name = paste0("synthetic_", original_name), 10 | original_name, 11 | worcs_directory = ".", 12 | verbose = TRUE, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{data}{A \code{data.frame} containing the synthetic data.} 18 | 19 | \item{synthetic_name}{Character, naming the file synthetic data should be 20 | written to. By 21 | default, prepends \code{"synthetic_"} to the \code{original_name}.} 22 | 23 | \item{original_name}{Character, naming an existing data resource in the WORCS 24 | project with which to associate the synthetic \code{data} object.} 25 | 26 | \item{worcs_directory}{Character, indicating the WORCS project directory to 27 | which to save data. The default value \code{"."} points to the current 28 | directory.} 29 | 30 | \item{verbose}{Logical. Whether or not to print status messages to 31 | the console. Default: TRUE} 32 | 33 | \item{...}{Additional arguments passed to and from functions.} 34 | } 35 | \value{ 36 | Returns \code{NULL} invisibly. This 37 | function is called for its side effects. 38 | } 39 | \description{ 40 | This function adds a user-specified synthetic data resource for 41 | public use to a WORCS project with closed data. 42 | } 43 | \examples{ 44 | # Create directory to run the example 45 | old_wd <- getwd() 46 | test_dir <- file.path(tempdir(), "add_synthetic") 47 | dir.create(test_dir) 48 | setwd(test_dir) 49 | worcs:::write_worcsfile(".worcs") 50 | # Prepare data 51 | df <- iris[1:3, ] 52 | # Run closed_data without synthetic 53 | closed_data(df, codebook = NULL, synthetic = FALSE) 54 | # Manually add synthetic 55 | add_synthetic(df, original_name = "df.csv") 56 | # Remove original from file and environment 57 | file.remove("df.csv") 58 | rm(df) 59 | # See that load_data() now loads the synthetic file 60 | load_data() 61 | # Cleaning example directory 62 | setwd(old_wd) 63 | unlink(test_dir, recursive = TRUE) 64 | } 65 | \seealso{ 66 | open_data closed_data save_data 67 | } 68 | -------------------------------------------------------------------------------- /man/add_targets.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/targets.R 3 | \name{add_targets} 4 | \alias{add_targets} 5 | \title{Add targets to WORCS Project} 6 | \usage{ 7 | add_targets(worcs_directory = ".", verbose = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{worcs_directory}{Character, indicating the WORCS project directory 11 | to which to save data. The default value "." points to the current directory. 12 | Default: '.'} 13 | 14 | \item{verbose}{Logical. Whether or not to print status messages to the 15 | console. Default: \code{TRUE}} 16 | 17 | \item{...}{Arguments passed to \code{targets::use_targets()}.} 18 | } 19 | \value{ 20 | No return value. This function is called for its side effects. 21 | } 22 | \description{ 23 | Add a computational pipeline to a \code{worcs} project using the 24 | \code{targets} and \code{tarchetypes} packages (which must be installed). See those 25 | packages for extensive documentation. 26 | } 27 | \examples{ 28 | # Create directory to run the example 29 | old_wd <- getwd() 30 | test_dir <- file.path(tempdir(), "targets") 31 | dir.create(test_dir) 32 | setwd(test_dir) 33 | file.create(".worcs") 34 | add_targets() 35 | # Cleaning example directory 36 | setwd(old_wd) 37 | unlink(test_dir, recursive = TRUE) 38 | } 39 | -------------------------------------------------------------------------------- /man/check_endpoints.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/endpoint.R 3 | \name{check_endpoints} 4 | \alias{check_endpoints} 5 | \title{Check endpoints in WORCS project} 6 | \usage{ 7 | check_endpoints(worcs_directory = ".", verbose = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{worcs_directory}{Character, indicating the WORCS project directory 11 | to which to save data. The default value "." points to the current directory. 12 | Default: '.'} 13 | 14 | \item{verbose}{Logical. Whether or not to print status messages to the 15 | console. Default: TRUE} 16 | 17 | \item{...}{Additional arguments.} 18 | } 19 | \value{ 20 | Returns a logical value (TRUE/FALSE) invisibly. 21 | } 22 | \description{ 23 | Check that the checksums of all endpoints in a WORCS project 24 | match their snapshots. 25 | } 26 | \examples{ 27 | # Create directory to run the example 28 | old_wd <- getwd() 29 | test_dir <- file.path(tempdir(), "check_endpoint") 30 | dir.create(test_dir) 31 | setwd(test_dir) 32 | file.create(".worcs") 33 | writeLines("test", "test.txt") 34 | add_endpoint("test.txt") 35 | check_endpoints() 36 | # Cleaning example directory 37 | setwd(old_wd) 38 | unlink(test_dir, recursive = TRUE) 39 | } 40 | \seealso{ 41 | \code{\link[worcs]{add_endpoint}} 42 | \code{\link[worcs]{snapshot_endpoints}} 43 | } 44 | -------------------------------------------------------------------------------- /man/check_worcs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/worcs_badge.R 3 | \name{check_worcs} 4 | \alias{check_worcs} 5 | \title{Evaluate project with respect to WORCS checklist} 6 | \usage{ 7 | check_worcs(path = ".", verbose = TRUE) 8 | } 9 | \arguments{ 10 | \item{path}{Character. Path to a WORCS project folder (a project with a 11 | \code{.worcs} file). Default: '.' (path to current directory).} 12 | 13 | \item{verbose}{Logical. Whether or not to show status messages while 14 | evaluating the checklist. Default: \code{TRUE}.} 15 | } 16 | \value{ 17 | A \code{data.frame} with a description of the criteria, and a column 18 | with evaluations (\code{$pass}). For criteria that must be evaluated 19 | manually, \code{$pass} will be \code{FALSE}. 20 | } 21 | \description{ 22 | Evaluates whether a project meets the criteria of the WORCS 23 | checklist (see \code{\link{worcs_checklist}}). 24 | } 25 | \examples{ 26 | example_dir <- file.path(tempdir(), "badge") 27 | dir.create(example_dir) 28 | write("a", file.path(example_dir, ".worcs")) 29 | check_worcs(path = example_dir) 30 | } 31 | -------------------------------------------------------------------------------- /man/check_worcs_installation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/check_installation.R 3 | \name{check_worcs_installation} 4 | \alias{check_worcs_installation} 5 | \alias{check_dependencies} 6 | \alias{check_git} 7 | \alias{check_github} 8 | \alias{check_ssh} 9 | \alias{check_tinytext} 10 | \alias{check_tinytex} 11 | \alias{check_rmarkdown} 12 | \alias{check_renv} 13 | \title{Check worcs dependencies} 14 | \usage{ 15 | check_worcs_installation(what = "all") 16 | 17 | check_dependencies(package = "worcs") 18 | 19 | check_git() 20 | 21 | check_github(pat = TRUE, ssh = FALSE) 22 | 23 | check_ssh() 24 | 25 | check_tinytext() 26 | 27 | check_tinytex() 28 | 29 | check_rmarkdown() 30 | 31 | check_renv() 32 | } 33 | \arguments{ 34 | \item{what}{Character vector indicating which dependencies to check. Default: 35 | \code{"all"}. All checks defined in the Usage section can be called, e.g. 36 | \code{check_git} can be called using the argument \code{what = "git"}.} 37 | 38 | \item{package}{Atomic character vector, indicating for which package to check 39 | the dependencies.} 40 | 41 | \item{pat}{Logical, whether to run tests for the existence and functioning of 42 | a GitHub Personal Access Token (PAT). This is the preferred method of 43 | authentication, so defaults to TRUE.} 44 | 45 | \item{ssh}{Logical, whether to run tests for the existence and functioning of 46 | an SSH key. This method of authentication is not recommended, so defaults to 47 | FALSE.} 48 | } 49 | \value{ 50 | Logical, indicating whether all checks passed or not. 51 | } 52 | \description{ 53 | This function checks that all worcs dependencies are correctly 54 | installed, and suggests how to remedy any missing dependencies. 55 | } 56 | \examples{ 57 | check_worcs_installation("none") 58 | } 59 | \keyword{internal} 60 | -------------------------------------------------------------------------------- /man/cite_all.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/citations.R 3 | \name{cite_all} 4 | \alias{cite_all} 5 | \title{Comprehensive citation Knit function for 'RStudio'} 6 | \usage{ 7 | cite_all(...) 8 | } 9 | \arguments{ 10 | \item{...}{All arguments are passed to \code{\link[rmarkdown]{render}}.} 11 | } 12 | \value{ 13 | Returns \code{NULL} invisibly. This 14 | function is called for its side effect of rendering an 15 | 'R Markdown' file. 16 | } 17 | \description{ 18 | This is a wrapper for \code{\link[rmarkdown]{render}}. First, this function 19 | parses the citations in the document, converting citations 20 | marked with double at sign, e.g.: \code{@@reference2020}, into normal 21 | citations, e.g.: \code{@reference2020}. Then, it renders the file. 22 | } 23 | \examples{ 24 | # NOTE: Do not use this function interactively, as in the example below. 25 | # Only specify it as custom knit function in an 'R Markdown' file, like so: 26 | # knit: worcs::cite_all 27 | 28 | if (rmarkdown::pandoc_available("2.0")){ 29 | if(requireNamespace("withr", quietly = TRUE)){ 30 | withr::with_tempdir({ 31 | file_name <- file.path("citeall.Rmd") 32 | loc <- rmarkdown::draft(file_name, 33 | template = "github_document", 34 | package = "rmarkdown", 35 | create_dir = FALSE, 36 | edit = FALSE) 37 | write(c("", "Optional reference: @reference2020"), 38 | file = file_name, append = TRUE) 39 | cite_all(file_name) 40 | }, pattern = "cite_all") 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /man/cite_essential.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/citations.R 3 | \name{cite_essential} 4 | \alias{cite_essential} 5 | \title{Essential citations Knit function for 'RStudio'} 6 | \usage{ 7 | cite_essential(...) 8 | } 9 | \arguments{ 10 | \item{...}{All arguments are passed to \code{\link[rmarkdown]{render}}.} 11 | } 12 | \value{ 13 | Returns \code{NULL} invisibly. This 14 | function is called for its side effect of rendering an 15 | 'R Markdown' file. 16 | } 17 | \description{ 18 | This is a wrapper for \code{\link[rmarkdown]{render}}. First, this function 19 | parses the citations in the document, removing citations 20 | marked with double at sign, e.g.: \code{@@reference2020}. Then, it renders 21 | the file. 22 | } 23 | \examples{ 24 | # NOTE: Do not use this function interactively, as in the example below. 25 | # Only specify it as custom knit function in an R Markdown file, like so: 26 | # knit: worcs::cite_all 27 | 28 | if (rmarkdown::pandoc_available("2.0")){ 29 | file_name <- tempfile("citeessential", fileext = ".Rmd") 30 | rmarkdown::draft(file_name, 31 | template = "github_document", 32 | package = "rmarkdown", 33 | create_dir = FALSE, 34 | edit = FALSE) 35 | write(c("", "Optional reference: @reference2020"), 36 | file = file_name, append = TRUE) 37 | cite_essential(file_name) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /man/codebook.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/codebook.R 3 | \name{make_codebook} 4 | \alias{make_codebook} 5 | \title{Create codebook for a dataset} 6 | \usage{ 7 | make_codebook( 8 | data, 9 | filename = "codebook.Rmd", 10 | render_file = TRUE, 11 | csv_file = gsub("rmd$", "csv", filename, ignore.case = TRUE), 12 | verbose = TRUE 13 | ) 14 | } 15 | \arguments{ 16 | \item{data}{A data.frame for which to create a codebook.} 17 | 18 | \item{filename}{Character. File name to write the codebook \code{rmarkdown} 19 | file to.} 20 | 21 | \item{render_file}{Logical. Whether or not to render the document.} 22 | 23 | \item{csv_file}{Character. File name to write the codebook \code{rmarkdown} 24 | file to. By default, uses the filename stem of the \code{filename} argument. 25 | Set to \code{NULL} to write the codebook only to the 'R Markdown' file, and 26 | not to \code{.csv}.} 27 | 28 | \item{verbose}{Logical. Whether or not to print status messages to 29 | the console. Default: TRUE} 30 | } 31 | \value{ 32 | \code{Logical}, indicating whether or not the operation was 33 | successful. This function is mostly called for its side effect of rendering 34 | an 'R Markdown' codebook. 35 | } 36 | \description{ 37 | Creates a codebook for a dataset in 'R Markdown' format, and 38 | renders it to 'markdown' for 'GitHub'. A codebook contains metadata and 39 | documentation for a data file. 40 | We urge users to customize the automatically generated 'R Markdown' 41 | document and re-knit it, for example, to add a paragraph with details on 42 | the data collection procedures. The variable descriptives are stored in 43 | a \code{.csv} file, which can be edited in 'R' or a spreadsheet program. 44 | Columns can be appended, and we encourage users to complete at least the 45 | following two columns in this file: 46 | \describe{ 47 | \item{category}{Describe the type of variable in this column. For example: 48 | "morality".} 49 | \item{description}{Provide a plain-text description of the variable. For 50 | example, the full text of a questionnaire item: "People should be willing to 51 | do anything to help a member of their family".} 52 | } 53 | Re-knitting the 'R Markdown' file (using \code{\link[rmarkdown]{render}}) will 54 | transfer these changes to the 'markdown' file for 'GitHub'. 55 | } 56 | \examples{ 57 | if(rmarkdown::pandoc_available("2.0")){ 58 | library(rmarkdown) 59 | library(knitr) 60 | filename <- tempfile("codebook", fileext = ".Rmd") 61 | make_codebook(iris, filename = filename, csv_file = NULL) 62 | unlink(c( 63 | ".worcs", 64 | filename, 65 | gsub("\\\\.Rmd", "\\\\.md", filename), 66 | gsub("\\\\.Rmd", "\\\\.html", filename), 67 | gsub("\\\\.Rmd", "_files", filename) 68 | ), recursive = TRUE) 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /man/data_label.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/label_data.R 3 | \name{data_label} 4 | \alias{data_label} 5 | \title{Label factor variables using metadata} 6 | \usage{ 7 | data_label( 8 | x, 9 | variables = names(x), 10 | value_labels = read_yaml(paste0("value_labels_", substitute(x), ".yml")) 11 | ) 12 | } 13 | \arguments{ 14 | \item{x}{A \code{data.frame}.} 15 | 16 | \item{variables}{Column names of \code{x} to replace, Default: \code{names(x)}} 17 | 18 | \item{value_labels}{A list with value labels, typically read from metadata 19 | generated by \code{\link{open_data}} or \code{\link{closed_data}}. 20 | Default: \code{read_yaml(paste0("value_labels_", substitute(x), ".yml"))}} 21 | } 22 | \value{ 23 | A \code{data.frame}. 24 | } 25 | \description{ 26 | For each column of \code{x}, this function checks whether value 27 | labels exist in \code{value_labels}. If so, integer values are replaced with these 28 | value labels. 29 | } 30 | \examples{ 31 | \dontrun{ 32 | if(interactive()){ 33 | labs <- list(x = list(class = "factor", `1` = "a", `2` = "b")) 34 | df <- data.frame(x = 1:2) 35 | df <- data_label(df, value_labels = labs) 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /man/data_unlabel.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/label_data.R 3 | \name{data_unlabel} 4 | \alias{data_unlabel} 5 | \title{Drop value labels} 6 | \usage{ 7 | data_unlabel(x, variables = names(x)[sapply(x, inherits, what = "factor")]) 8 | } 9 | \arguments{ 10 | \item{x}{A \code{data.frame}.} 11 | 12 | \item{variables}{Column names of \code{x} to coerce to integer.} 13 | } 14 | \value{ 15 | A \code{data.frame}. 16 | } 17 | \description{ 18 | Coerces \code{factor} and \code{ordered} variables to class \code{integer}. 19 | } 20 | \examples{ 21 | \dontrun{ 22 | if(interactive()){ 23 | df <- data.frame(x = factor(c("a", "b"))) 24 | df <- data_unlabel(df) 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /man/descriptives.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/descriptives.R 3 | \name{descriptives} 4 | \alias{descriptives} 5 | \title{Describe a dataset} 6 | \usage{ 7 | descriptives(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{An object for which a method exists.} 11 | 12 | \item{...}{Additional arguments.} 13 | } 14 | \value{ 15 | A \code{data.frame} with descriptive statistics for \code{x}. 16 | } 17 | \description{ 18 | Provide descriptive statistics for a dataset. 19 | } 20 | \examples{ 21 | descriptives(iris) 22 | } 23 | -------------------------------------------------------------------------------- /man/export_project.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/export.R 3 | \name{export_project} 4 | \alias{export_project} 5 | \title{Export project to .zip file} 6 | \usage{ 7 | export_project(zipfile = NULL, worcs_directory = ".", open_data = TRUE) 8 | } 9 | \arguments{ 10 | \item{zipfile}{Character. Path to a \code{.zip} file that is to be created. 11 | The default argument \code{NULL} creates a \code{.zip} file in the directory 12 | one level above the 'worcs' project directory. By default, all files tracked 13 | by 'Git' are included in the \code{.zip} file, excluding 'data.csv' if 14 | \code{open_data = FALSE}.} 15 | 16 | \item{worcs_directory}{Character. Path to the WORCS project directory to 17 | export. Defaults to \code{"."}, which refers to the current working 18 | directory.} 19 | 20 | \item{open_data}{Logical. Whether or not to include the original data, 21 | 'data.csv', if this file exists. If \code{open_data = FALSE} and an open 22 | data file does exist, then it is excluded from the \code{.zip} file. If it 23 | does not yet exist, a synthetic data set is generated and added to the 24 | \code{.zip} file.} 25 | } 26 | \value{ 27 | Logical, indicating the success of the operation. This function is 28 | called for its side effect of creating a \code{.zip} file. 29 | } 30 | \description{ 31 | Export project to .zip file 32 | } 33 | \examples{ 34 | export_project(worcs_directory = tempdir()) 35 | } 36 | -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/man/figures/logo.png -------------------------------------------------------------------------------- /man/git_ignore.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/github.R 3 | \name{git_ignore} 4 | \alias{git_ignore} 5 | \title{Modify .gitignore file} 6 | \usage{ 7 | git_ignore(..., ignore = TRUE, repo = ".") 8 | } 9 | \arguments{ 10 | \item{...}{Any number of character arguments, representing files to be added 11 | to the .gitignore file.} 12 | 13 | \item{ignore}{Logical. Whether or not 'Git' should ignore these files.} 14 | 15 | \item{repo}{a path to an existing repository, or a git_repository object as 16 | returned by git_open, git_init or git_clone.} 17 | } 18 | \value{ 19 | No return value. This function is called for its side effects. 20 | } 21 | \description{ 22 | Arguments passed through \code{...} are added to the .gitignore 23 | file. Elements already present in the file are modified. 24 | When \code{ignore = TRUE}, the arguments are added to the .gitignore file, 25 | which will cause 'Git' to not track them. 26 | 27 | When \code{ignore = FALSE}, the arguments are prepended with \code{!}, 28 | This works as a "double negation", and will cause 'Git' to track the files. 29 | } 30 | \examples{ 31 | if(requireNamespace("withr", quietly = TRUE)){ 32 | withr::with_tempdir({ 33 | dir.create(".git") 34 | git_ignore("ignorethis.file") 35 | }) 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /man/git_remote_connect.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/github.R 3 | \name{git_remote_connect} 4 | \alias{git_remote_connect} 5 | \title{Connect to Existing 'GitHub' Repository} 6 | \usage{ 7 | git_remote_connect(repo, remote_repo) 8 | } 9 | \arguments{ 10 | \item{repo}{a path to an existing repository, or a git_repository object as returned by git_open, git_init or git_clone.} 11 | 12 | \item{remote_repo}{Character, indicating the name of a repository on your 13 | account.} 14 | } 15 | \value{ 16 | Invisibly returns a list with the following elements: 17 | \itemize{ 18 | \item repo_url: Character, URL of the connected repository 19 | \item repo_exists: Logical 20 | \item prior_commits: Logical 21 | } 22 | } 23 | \description{ 24 | Given that a 'GitHub' user is configured, with the appropriate 25 | permissions, this function connects to an existing repository. 26 | } 27 | \examples{ 28 | \dontrun{ 29 | git_remote_connect() 30 | } 31 | } 32 | \seealso{ 33 | \code{\link[gh]{gh_whoami}} 34 | \code{\link[gert]{git_fetch}}, \code{\link[gert]{git_remote}} 35 | } 36 | -------------------------------------------------------------------------------- /man/git_remote_create.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/github.R 3 | \name{git_remote_create} 4 | \alias{git_remote_create} 5 | \alias{git_release_publish} 6 | \title{Create a New 'GitHub' Repository} 7 | \usage{ 8 | git_remote_create(name, private = TRUE) 9 | 10 | git_release_publish(repo = ".", tag_name = NULL, release_name = NULL) 11 | } 12 | \arguments{ 13 | \item{name}{Name of the repository to be created.} 14 | 15 | \item{private}{Whether or not the repository should be private, defaults to 16 | \code{FALSE}.} 17 | 18 | \item{repo}{The path to the 'Git' repository.} 19 | 20 | \item{tag_name}{Optional character string to specify the tag name. By 21 | default, this is set to \code{NULL} and \code{git_release_publish()} uses version 22 | numbers starting with \verb{0.1.0} for both the \code{tag_name} and \code{release_name} 23 | arguments. Override this behavior, for example, to increment the major 24 | version number by specifying \verb{0.2.0}.} 25 | 26 | \item{release_name}{Optional character string to specify the tag name. By 27 | default, this is set to \code{NULL} and \code{git_release_publish()} uses version 28 | numbers starting with \verb{0.1.0} for both the \code{tag_name} and \code{release_name} 29 | arguments. Override this behavior, for example, to increment the major 30 | version number by specifying \verb{0.2.0}.} 31 | } 32 | \value{ 33 | Invisibly returns a logical value, 34 | indicating whether the function was successful or not. 35 | 36 | No return value. This function is called for its side effects. 37 | } 38 | \description{ 39 | Given that a 'GitHub' user is configured, with the appropriate 40 | permissions, this function creates a new repository on your account. 41 | 42 | Given that a 'GitHub' user is configured, with the appropriate 43 | permissions, this function pushes the current branch (if safe), 44 | then publishes a 'GitHub' Release of the repository indicated by 45 | \code{repo} to that user's account. 46 | } 47 | \examples{ 48 | \dontrun{ 49 | git_remote_create() 50 | } 51 | \dontrun{ 52 | git_release_publish() 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /man/git_update.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/github.R 3 | \name{git_update} 4 | \alias{git_update} 5 | \title{Add, commit, and push changes.} 6 | \usage{ 7 | git_update( 8 | message = paste0("update ", Sys.time()), 9 | files = ".", 10 | repo = ".", 11 | author, 12 | committer, 13 | remote, 14 | refspec, 15 | password, 16 | ssh_key, 17 | mirror, 18 | force, 19 | verbose = TRUE 20 | ) 21 | } 22 | \arguments{ 23 | \item{message}{a commit message} 24 | 25 | \item{files}{vector of paths relative to the git root directory. Use "." to stage all changed files.} 26 | 27 | \item{repo}{a path to an existing repository, or a git_repository object as returned by git_open, git_init or git_clone.} 28 | 29 | \item{author}{A git_signature value, default is git_signature_default.} 30 | 31 | \item{committer}{A git_signature value, default is same as author} 32 | 33 | \item{remote}{name of a remote listed in git_remote_list()} 34 | 35 | \item{refspec}{string with mapping between remote and local refs} 36 | 37 | \item{password}{a string or a callback function to get passwords for authentication or password protected ssh keys. Defaults to askpass which checks getOption('askpass').} 38 | 39 | \item{ssh_key}{path or object containing your ssh private key. By default we look for keys in ssh-agent and credentials::ssh_key_info.} 40 | 41 | \item{mirror}{use the --mirror flag} 42 | 43 | \item{force}{use the --force flag} 44 | 45 | \item{verbose}{display some progress info while downloading} 46 | } 47 | \value{ 48 | No return value. This function is called for its side effects. 49 | } 50 | \description{ 51 | This function is a wrapper for 52 | \code{\link[gert:git_add]{git_add}}, \code{\link[gert:git_commit]{git_commit}}, 53 | and 54 | \code{\link[gert:git_push]{git_push}}. It adds all locally changed files to the 55 | staging area of the local 'Git' repository, then commits these changes 56 | (with an optional) \code{message}, and then pushes them to a remote 57 | repository. This is used for making a "cloud backup" of local changes. 58 | Do not use this function when working with privacy sensitive data, 59 | or any other file that should not be pushed to a remote repository. 60 | The \code{\link[gert:git_add]{git_add}} argument 61 | \code{force} is disabled by default, 62 | to avoid accidentally committing and pushing a file that is listed in 63 | \code{.gitignore}. 64 | } 65 | \examples{ 66 | git_update() 67 | } 68 | -------------------------------------------------------------------------------- /man/git_user.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/github.R 3 | \name{git_user} 4 | \alias{git_user} 5 | \title{Set global 'Git' credentials} 6 | \usage{ 7 | git_user(name, email, overwrite = !has_git_user(), verbose = TRUE) 8 | } 9 | \arguments{ 10 | \item{name}{Character. The user name you want to use with 'Git'.} 11 | 12 | \item{email}{Character. The email address you want to use with 'Git'.} 13 | 14 | \item{overwrite}{Logical. Whether or not to overwrite existing 'Git' 15 | credentials. Use this to prevent code from accidentally overwriting existing 16 | 'Git' credentials. The default value uses \code{\link{has_git_user}} 17 | to set overwrite to \code{FALSE} if user credentials already exist, and to 18 | \code{TRUE} if no user credentials exist.} 19 | 20 | \item{verbose}{Logical. Whether or not to print status messages to 21 | the console. Default: TRUE} 22 | } 23 | \value{ 24 | No return value. This function is called for its side effects. 25 | } 26 | \description{ 27 | This function is a wrapper for 28 | \code{\link[gert:git_config]{git_config_global_set}}. 29 | It sets two name/value pairs at 30 | once: \code{name = "user.name"} is set to the value of the \code{name} 31 | argument, and \code{name = "user.email"} is set to the value of the 32 | \code{email} argument. 33 | } 34 | \examples{ 35 | git_user("name", "email", overwrite = FALSE) 36 | } 37 | -------------------------------------------------------------------------------- /man/github_action_check_endpoints.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/github_actions.R 3 | \name{github_action_check_endpoints} 4 | \alias{github_action_check_endpoints} 5 | \alias{github_action_reproduce} 6 | \title{Set up GitHub Actions to Check Endpoints} 7 | \usage{ 8 | github_action_check_endpoints(worcs_directory = ".") 9 | 10 | github_action_reproduce(worcs_directory = ".") 11 | } 12 | \arguments{ 13 | \item{worcs_directory}{Character, indicating the WORCS project directory 14 | to which to save data. The default value "." points to the current directory. 15 | Default: '.'} 16 | } 17 | \value{ 18 | No return value. This function is called for its side effects. 19 | } 20 | \description{ 21 | Sets up a GitHub Action to perform continuous integration (CI) 22 | for a WORCS project. CI automatically evaluates \code{check_endpoints()} or 23 | \code{reproduce(check_endpoints = TRUE)}. 24 | at each push or pull request. 25 | } 26 | \seealso{ 27 | \code{\link[usethis]{use_github_action}} 28 | \code{\link[worcs]{add_endpoint}} 29 | \code{\link[worcs]{check_endpoints}} 30 | } 31 | -------------------------------------------------------------------------------- /man/has_git_user.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/github.R 3 | \name{has_git_user} 4 | \alias{has_git_user} 5 | \title{Check whether global 'Git' credentials exist} 6 | \usage{ 7 | has_git_user(repo = ".") 8 | } 9 | \arguments{ 10 | \item{repo}{The path to the git repository.} 11 | } 12 | \value{ 13 | Logical, indicating whether 'Git' global configuration settings could 14 | be retrieved, and contained the values 15 | \code{user.name} and \code{user.email}. 16 | } 17 | \description{ 18 | Check whether the values \code{user.name} and \code{user.email} 19 | exist exist for the current repository. 20 | Uses \code{\link[gert:git_signature]{git_signature_default}}. 21 | } 22 | \examples{ 23 | testdir <- file.path(tempdir(), "test_git_user") 24 | dir.create(testdir) 25 | gert::git_init(testdir) 26 | has_git_user(testdir) 27 | unlink(testdir, recursive = TRUE) 28 | } 29 | -------------------------------------------------------------------------------- /man/list_endpoints.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/endpoint.R 3 | \name{list_endpoints} 4 | \alias{list_endpoints} 5 | \title{List endpoints in WORCS project} 6 | \usage{ 7 | list_endpoints(worcs_directory = ".", verbose = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{worcs_directory}{Character, indicating the WORCS project directory 11 | to which to save data. The default value "." points to the current directory. 12 | Default: '.'} 13 | 14 | \item{verbose}{Logical. Whether or not to print status messages to the 15 | console. Default: TRUE} 16 | 17 | \item{...}{Additional arguments.} 18 | } 19 | \value{ 20 | None, prints to the console. 21 | } 22 | \description{ 23 | List the endpoints in a WORCS project. 24 | } 25 | \examples{ 26 | if(requireNamespace("withr", quietly = TRUE)){ 27 | withr::with_tempdir({ 28 | file.create(".worcs") 29 | write.csv(iris, "iris.csv") 30 | add_endpoint("iris.csv") 31 | list_endpoints() 32 | }) 33 | } 34 | } 35 | \seealso{ 36 | \code{\link[worcs]{add_endpoint}} 37 | \code{\link[worcs]{snapshot_endpoints}} 38 | } 39 | -------------------------------------------------------------------------------- /man/load_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/save_load.R 3 | \name{load_data} 4 | \alias{load_data} 5 | \title{Load WORCS project data} 6 | \usage{ 7 | load_data( 8 | worcs_directory = ".", 9 | to_envir = TRUE, 10 | envir = parent.frame(1), 11 | verbose = TRUE, 12 | use_metadata = TRUE 13 | ) 14 | } 15 | \arguments{ 16 | \item{worcs_directory}{Character, indicating the WORCS project directory from 17 | which to load data. The default value \code{"."} points to the current 18 | directory.} 19 | 20 | \item{to_envir}{Logical, indicating whether to load objects directly into 21 | the environment, or return a \code{\link{list}} containing the objects. The 22 | environment is designated by argument \code{envir}. Loading 23 | objects directly into the global environment is user-friendly, but has the 24 | risk of overwriting an existing object with the same name, as explained in 25 | \code{\link{load}}. The function \code{load_data} gives a warning when this 26 | happens.} 27 | 28 | \item{envir}{The environment where the data should be loaded. The default 29 | value \code{parent.frame(1)} refers to the global environment in an 30 | interactive session.} 31 | 32 | \item{verbose}{Logical. Whether or not to print status messages to 33 | the console. Default: TRUE} 34 | 35 | \item{use_metadata}{Logical. Whether or not to use the codebook and 36 | value labels and attempt to coerce the class and values of variables to 37 | those recorded therein. Default: TRUE} 38 | } 39 | \value{ 40 | Returns a list invisibly. If \code{to_envir = TRUE}, this list 41 | contains the loaded data files. If \code{to_envir = FALSE}, the list is 42 | empty, and the loaded data files are attached directly to the global 43 | environment. 44 | } 45 | \description{ 46 | Scans the WORCS project file for data that have been saved using 47 | \code{\link{open_data}} or \code{\link{closed_data}}, and loads these data 48 | into the global (working) environment. The function will load the original 49 | data if available on the current system. If only a synthetic dataset is 50 | available, this function loads the synthetic data. 51 | The name of the object containing the data is derived from the file name by 52 | removing the file extension, and, when applicable, the prefix 53 | \code{"synthetic_"}. Thus, both \code{"data.csv"} and 54 | \code{"synthetic_data.csv"} will be loaded into an object called \code{data}. 55 | } 56 | \examples{ 57 | if(requireNamespace("withr", quietly = TRUE)){ 58 | withr::with_tempdir({ 59 | file.create(".worcs") 60 | df <- iris[1:5, ] 61 | df$Species <- droplevels(df$Species) 62 | closed_data(df, codebook = NULL) 63 | temp_env <- new.env() 64 | load_data(envir = temp_env) 65 | rm("df", envir = temp_env) 66 | file.remove("df.csv") 67 | load_data(envir = temp_env) 68 | }) 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /man/load_entrypoint.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/load_entrypoint.R 3 | \name{load_entrypoint} 4 | \alias{load_entrypoint} 5 | \title{Load project entry points} 6 | \usage{ 7 | load_entrypoint(worcs_directory = ".", verbose = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{worcs_directory}{Character, indicating the WORCS project directory to 11 | which to save data. The default value \code{"."} points to the current 12 | directory.} 13 | 14 | \item{verbose}{Logical. Whether or not to print status messages to 15 | the console. Default: TRUE} 16 | 17 | \item{...}{Additional arguments passed to \code{\link[utils]{file.edit}}.} 18 | } 19 | \value{ 20 | No return value. This function is called for its side effects. 21 | } 22 | \description{ 23 | Loads the designated project entry point into the default 24 | editor, using \code{\link[utils]{file.edit}}. 25 | } 26 | \examples{ 27 | \dontrun{ 28 | if(requireNamespace("withr", quietly = TRUE)){ 29 | withr::with_tempdir({ 30 | # Prepare worcs file and dummy entry point 31 | worcs:::write_worcsfile(".worcs", entry_point = "test.txt") 32 | writeLines("Hello world", con = file("test.txt", "w")) 33 | # Demonstrate load_entrypoint() 34 | load_entrypoint() 35 | }) 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /man/notify_synthetic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/save_load.R 3 | \name{notify_synthetic} 4 | \alias{notify_synthetic} 5 | \title{Notify the user when synthetic data are being used} 6 | \usage{ 7 | notify_synthetic(..., msg = NULL) 8 | } 9 | \arguments{ 10 | \item{...}{Objects of class \code{worcs_data}. The function will check if 11 | these are original or synthetic data.} 12 | 13 | \item{msg}{Expression containing the message to print in case not all 14 | \code{worcs_data} are original. This message may refer to \code{is_synth}, 15 | a logical vector indicating which \code{worcs_data} objects are synthetic.} 16 | } 17 | \value{ 18 | No return value. This function is called for its side effect of 19 | printing a notification message. 20 | } 21 | \description{ 22 | This function prints a notification message when some or all of 23 | the data used in a project are synthetic (see \code{\link{closed_data}} and 24 | \code{\link{synthetic}}). See details for important information. 25 | } 26 | \details{ 27 | The preferred way to use this function is to provide specific data 28 | objects in the function call, using the \code{...} argument. 29 | If no such objects are provided, \code{notify_synthetic} will scan the 30 | parent environment for objects of class \code{worcs_data}. 31 | 32 | This function is emphatically designed to be included in an 'R Markdown' 33 | file, to dynamically generate a notification message when a third party 34 | 'Knits' such a document without having access to all original data. 35 | } 36 | \examples{ 37 | df <- iris 38 | class(df) <- c("worcs_data", class(df)) 39 | attr(df, "type") <- "synthetic" 40 | result <- capture.output(notify_synthetic(df, msg = "synthetic")) 41 | } 42 | \seealso{ 43 | closed_data synthetic add_synthetic 44 | } 45 | -------------------------------------------------------------------------------- /man/open_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/save_load.R 3 | \name{open_data} 4 | \alias{open_data} 5 | \title{Use open data in WORCS project} 6 | \usage{ 7 | open_data( 8 | data, 9 | filename = paste0(deparse(substitute(data)), ".csv"), 10 | codebook = paste0("codebook_", deparse(substitute(data)), ".Rmd"), 11 | value_labels = paste0("value_labels_", deparse(substitute(data)), ".yml"), 12 | worcs_directory = ".", 13 | save_expression = write.csv(x = data, file = filename, row.names = FALSE), 14 | load_expression = read.csv(file = filename, stringsAsFactors = TRUE), 15 | ... 16 | ) 17 | } 18 | \arguments{ 19 | \item{data}{A data.frame to save.} 20 | 21 | \item{filename}{Character, naming the file data should be written to. By 22 | default, constructs a filename from the name of the object passed to 23 | \code{data}.} 24 | 25 | \item{codebook}{Character, naming the file the codebook should be written to. 26 | An 'R Markdown' codebook will be created and rendered to 27 | \code{\link[rmarkdown]{github_document}} ('markdown' for 'GitHub'). 28 | By default, constructs a filename from the name of the object passed to 29 | \code{data}, adding the word 'codebook'. 30 | Set this argument to \code{NULL} to avoid creating a codebook.} 31 | 32 | \item{value_labels}{Character, naming the file the value labels of factors 33 | and ordinal variables should be written to. 34 | By default, constructs a filename from the name of the object passed to 35 | \code{data}, adding the word 'value_labels'. 36 | Set this argument to \code{NULL} to avoid creating a file with value labels.} 37 | 38 | \item{worcs_directory}{Character, indicating the WORCS project directory to 39 | which to save data. The default value \code{"."} points to the current 40 | directory.} 41 | 42 | \item{save_expression}{An R-expression used to save the \code{data}. 43 | Defaults to \code{write.csv(x = data, file = filename, row.names = FALSE)}, 44 | which writes a comma-separated, spreadsheet-style file. 45 | The arguments \code{data} and \code{filename} are passed from 46 | \code{open_data()} to the expression defined in \code{save_expression}.} 47 | 48 | \item{load_expression}{An R-expression used to load the \code{data} from the 49 | file created by \code{save_expression}. Defaults to 50 | \code{read.csv(file = filename, stringsAsFactors = TRUE)}. This expression 51 | is stored in the project's \code{.worcs} file, and invoked by 52 | \code{load_data()}.} 53 | 54 | \item{...}{Additional arguments passed to and from functions.} 55 | } 56 | \value{ 57 | Returns \code{NULL} invisibly. This 58 | function is called for its side effects. 59 | } 60 | \description{ 61 | This function saves a data.frame as a \code{.csv} file (using 62 | \code{\link[utils:write.table]{write.csv}}), stores a checksum in '.worcs', 63 | and amends the \code{.gitignore} file to exclude \code{filename}. 64 | } 65 | \examples{ 66 | if(requireNamespace("withr", quietly = TRUE)){ 67 | withr::with_tempdir({ 68 | file.create(".worcs") 69 | df <- iris[1:5, ] 70 | open_data(df, codebook = NULL) 71 | }) 72 | } 73 | } 74 | \seealso{ 75 | open_data closed_data save_data 76 | } 77 | -------------------------------------------------------------------------------- /man/remove_endpoint.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/endpoint.R 3 | \name{remove_endpoint} 4 | \alias{remove_endpoint} 5 | \title{Remove endpoint from WORCS project} 6 | \usage{ 7 | remove_endpoint(filename = NULL, worcs_directory = ".", verbose = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{filename}{Character, indicating the file to be removed from the 11 | endpoints. 12 | Default: NULL.} 13 | 14 | \item{worcs_directory}{Character, indicating the WORCS project directory 15 | to which to save data. The default value "." points to the current directory. 16 | Default: '.'} 17 | 18 | \item{verbose}{Logical. Whether or not to print status messages to the 19 | console. Default: TRUE} 20 | 21 | \item{...}{Additional arguments.} 22 | } 23 | \value{ 24 | None, prints to the console. 25 | } 26 | \description{ 27 | Remove an endpoint from a WORCS project. 28 | } 29 | \examples{ 30 | if(requireNamespace("withr", quietly = TRUE)){ 31 | withr::with_tempdir({ 32 | file.create(".worcs") 33 | write.csv(iris, "iris.csv") 34 | add_endpoint("iris.csv") 35 | list_endpoints() 36 | remove_endpoint("iris.csv") 37 | list_endpoints() 38 | }) 39 | } 40 | } 41 | \seealso{ 42 | \code{\link[worcs]{add_endpoint}} 43 | \code{\link[worcs]{snapshot_endpoints}} 44 | } 45 | -------------------------------------------------------------------------------- /man/report.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/report.R 3 | \name{report} 4 | \alias{report} 5 | \title{Report formatted number} 6 | \usage{ 7 | report(x, digits = 2, equals = TRUE) 8 | } 9 | \arguments{ 10 | \item{x}{Numeric. Value to be reported} 11 | 12 | \item{digits}{Integer. Number of digits to round to.} 13 | 14 | \item{equals}{Logical. Whether to report an equals (or: smaller than) sign.} 15 | } 16 | \value{ 17 | An atomic character vector. 18 | } 19 | \description{ 20 | Report a number, rounded to a specific number of decimals (defaults to two), 21 | using \code{\link{formatC}}. Intended for 'R Markdown' reports. 22 | } 23 | \examples{ 24 | if(interactive()){ 25 | report(.0234) 26 | } 27 | } 28 | \author{ 29 | Caspar J. van Lissa 30 | } 31 | \keyword{internal} 32 | -------------------------------------------------------------------------------- /man/reproduce.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/recipes.R 3 | \name{reproduce} 4 | \alias{reproduce} 5 | \title{Reproduce WORCS Project} 6 | \usage{ 7 | reproduce(worcs_directory = ".", verbose = TRUE, check_endpoints = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{worcs_directory}{Character, indicating the WORCS project directory 11 | to which to save data. The default value "." points to the current directory. 12 | Default: '.'} 13 | 14 | \item{verbose}{Logical. Whether or not to print status messages to the 15 | console. Default: \code{TRUE}} 16 | 17 | \item{check_endpoints}{Logical. Whether or not to call \code{check_endpoints()} 18 | after reproducing the recipe. Default: \code{TRUE}} 19 | 20 | \item{...}{Additional arguments.} 21 | } 22 | \value{ 23 | No return value. This function is called for its side effects. 24 | } 25 | \description{ 26 | Evaluate the recipe contained in a WORCS project to derive its 27 | endpoints. 28 | } 29 | \examples{ 30 | # Create directory to run the example 31 | if(requireNamespace("withr", quietly = TRUE)){ 32 | withr::with_tempdir({ 33 | file.create(".worcs") 34 | worcs:::add_recipe(recipe = 'writeLines("test", "test.txt")') 35 | }) 36 | } 37 | } 38 | \seealso{ 39 | \code{\link[worcs]{add_endpoint}} 40 | \code{\link[worcs]{snapshot_endpoints}} 41 | \code{\link[worcs]{check_endpoints}} 42 | } 43 | -------------------------------------------------------------------------------- /man/skew_kurtosis.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/descriptives.R 3 | \name{skew_kurtosis} 4 | \alias{skew_kurtosis} 5 | \title{Calculate skew and kurtosis} 6 | \usage{ 7 | skew_kurtosis(x, verbose = FALSE, se = FALSE, ...) 8 | } 9 | \arguments{ 10 | \item{x}{An object for which a method exists.} 11 | 12 | \item{verbose}{Logical. Whether or not to print messages to the console, 13 | Default: FALSE} 14 | 15 | \item{se}{Whether or not to return the standard errors, Default: FALSE} 16 | 17 | \item{...}{Additional arguments to pass to and from functions.} 18 | } 19 | \value{ 20 | A \code{matrix} of skew and kurtosis statistics for \code{x}. 21 | } 22 | \description{ 23 | Calculate skew and kurtosis, standard errors for both, and the 24 | estimates divided by two times the standard error. If this latter quantity 25 | exceeds an absolute value of 1, the skew/kurtosis is significant. With very 26 | large sample sizes, significant skew/kurtosis is common. 27 | } 28 | \examples{ 29 | skew_kurtosis(datasets::anscombe) 30 | } 31 | -------------------------------------------------------------------------------- /man/snapshot_endpoints.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/endpoint.R 3 | \name{snapshot_endpoints} 4 | \alias{snapshot_endpoints} 5 | \title{Snapshot endpoints in WORCS project} 6 | \usage{ 7 | snapshot_endpoints(worcs_directory = ".", verbose = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{worcs_directory}{Character, indicating the WORCS project directory 11 | to which to save data. The default value "." points to the current directory. 12 | Default: '.'} 13 | 14 | \item{verbose}{Logical. Whether or not to print status messages to the 15 | console. Default: TRUE} 16 | 17 | \item{...}{Additional arguments.} 18 | } 19 | \value{ 20 | No return value. This function is called for its side effects. 21 | } 22 | \description{ 23 | Update the checksums of all endpoints in a WORCS project. 24 | } 25 | \examples{ 26 | # Create directory to run the example 27 | old_wd <- getwd() 28 | test_dir <- file.path(tempdir(), "update_endpoint") 29 | dir.create(test_dir) 30 | setwd(test_dir) 31 | file.create(".worcs") 32 | writeLines("test", "test.txt") 33 | add_endpoint("test.txt") 34 | writeLines("second test", "test.txt") 35 | snapshot_endpoints() 36 | # Cleaning example directory 37 | setwd(old_wd) 38 | unlink(test_dir, recursive = TRUE) 39 | } 40 | \seealso{ 41 | \code{\link[worcs]{add_endpoint}} 42 | \code{\link[worcs]{check_endpoints}} 43 | } 44 | -------------------------------------------------------------------------------- /man/worcs_badge.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/worcs_badge.R 3 | \name{worcs_badge} 4 | \alias{worcs_badge} 5 | \title{Add WORCS badge to README.md} 6 | \usage{ 7 | worcs_badge( 8 | path = ".", 9 | update_readme = "README.md", 10 | update_csv = "checklist.csv" 11 | ) 12 | } 13 | \arguments{ 14 | \item{path}{Character. This can either be the path to a WORCS project folder 15 | (a project with a \code{.worcs} file), or the path to a \code{checklist.csv} 16 | file. The latter is useful if you want to evaluate a manually updated 17 | checklist file. Default: '.' (path to current directory).} 18 | 19 | \item{update_readme}{Character. Path to the \code{README.md} file to add the 20 | badge to. Default: 'README.md'. Set to \code{NULL} to avoid updating the 21 | \code{README.md} file.} 22 | 23 | \item{update_csv}{Character. Path to the \code{README.md} file to add the 24 | badge to. Default: 'checklist.csv'. Set to \code{NULL} to avoid updating the 25 | \code{checklist.csv} file.} 26 | } 27 | \value{ 28 | No return value. This function is called for its side effects. 29 | } 30 | \description{ 31 | Evaluates whether a project meets the criteria of the WORCS 32 | checklist (see \code{\link{worcs_checklist}}), and adds a badge to the 33 | project's \code{README.md}. 34 | } 35 | \examples{ 36 | example_dir <- file.path(tempdir(), "badge") 37 | dir.create(example_dir) 38 | write("a", file.path(example_dir, ".worcs")) 39 | worcs_badge(path = example_dir, 40 | update_readme = NULL) 41 | } 42 | -------------------------------------------------------------------------------- /man/worcs_checklist.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/worcs_checklist.R 3 | \docType{data} 4 | \name{worcs_checklist} 5 | \alias{worcs_checklist} 6 | \title{WORCS checklist} 7 | \format{ 8 | A data frame with 15 rows and 5 variables. 9 | } 10 | \usage{ 11 | data(worcs_checklist) 12 | } 13 | \description{ 14 | This checklist can be used to see whether a project adheres to the principles 15 | of open reproducible code in science, as set out in the WORCS paper. 16 | } 17 | \details{ 18 | \tabular{lll}{ 19 | \strong{category} \tab \code{factor} \tab Category of the checklist 20 | element.\cr 21 | \strong{name} \tab \code{factor} \tab Name of the checklist 22 | element.\cr 23 | \strong{description} \tab \code{factor} \tab What are the requirements 24 | to claim that this checklist element is met?\cr 25 | \strong{importance} \tab \code{factor} \tab Whether the checklist 26 | element is essential to obtain a green 'open science' badge, or optional.\cr 27 | \strong{check} \tab \code{logical} \tab Whether the criterion is checked 28 | automatically by \code{\link{worcs_badge}}. 29 | } 30 | } 31 | \references{ 32 | Van Lissa, C. J., Brandmaier, A. M., Brinkman, L., Lamprecht, A., 33 | Peikert, A., , Struiksma, M. E., & Vreede, B. (2021) 34 | \doi{10.3233/DS-210031}. 35 | } 36 | \keyword{datasets} 37 | -------------------------------------------------------------------------------- /paper/Manuscript_DS.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/Manuscript_DS.zip -------------------------------------------------------------------------------- /paper/Manuscript_files/figure-latex/scholarbib-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/Manuscript_files/figure-latex/scholarbib-1.png -------------------------------------------------------------------------------- /paper/affiliation_yaml.R: -------------------------------------------------------------------------------- 1 | df <- read.csv("paper/authors.csv") 2 | 3 | aff <- df[, 6:ncol(df)] 4 | 5 | unique_aff <- as.vector(t(as.matrix(aff))) 6 | unique_aff <- unique_aff[!unique_aff == ""] 7 | unique_aff <- unique_aff[!duplicated(unique_aff)] 8 | 9 | aff <- do.call(c, lapply(1:length(unique_aff), function(x){ 10 | c(paste0(" - id: \"", x, "\""), paste0(" institution: \"", unique_aff[x], "\"")) 11 | })) 12 | 13 | cat("\n", aff, sep = "\n") 14 | -------------------------------------------------------------------------------- /paper/authors.R: -------------------------------------------------------------------------------- 1 | get_aut(what){ 2 | filename = "authors.csv" 3 | df <- read.csv(filename, stringsAsFactors = FALSE) 4 | if(!is.null(df[["order"]])) df <- df[order(df$order), -which(names(df) == "order")] 5 | aff <- df[, grep("^X(\\.\\d{1,})?$", names(df))] 6 | unique_aff <- as.vector(t(as.matrix(aff))) 7 | unique_aff <- unique_aff[!unique_aff == ""] 8 | unique_aff <- unique_aff[!duplicated(unique_aff)] 9 | df$affiliation <- apply(aff, 1, function(x){ 10 | paste(letters[which(unique_aff %in% unlist(x))], collapse = ",") 11 | }) 12 | 13 | aff <- paste0(letters[1:length(unique_aff)], ": ", unique_aff, collapse = "\n") 14 | 15 | df$name <- paste(df[[1]], df[[2]]) 16 | aut <- df[, c("name", "affiliation", "corresponding", "address", "email")] 17 | 18 | aut <- paste0(aut$name, "\\$\\^\\{", aut$affiliation, "\\}\\$", collapse = '\n') 19 | if(what == "aff"){ 20 | cat(aff) 21 | } else { 22 | browser() 23 | cat(aut) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /paper/authors.csv: -------------------------------------------------------------------------------- 1 | "data.csv.codebook","data.csv.synthetic" 2 | "codebook.Rmd","synthetic_data.csv" 3 | -------------------------------------------------------------------------------- /paper/authors_yaml.R: -------------------------------------------------------------------------------- 1 | df <- read.csv("paper/authors.csv") 2 | 3 | Caspar J. van Lissa\\ 4 | Utrecht University\\ 5 | Padualaan 14, 3584CH Utrecht, The Netherlands\\ 6 | E-mail: \href{mailto:c.j.vanlissa@uu.nl}{\nolinkurl{c.j.vanlissa@uu.nl}}\\ 7 | out <- vector("character") 8 | for(i in 1:nrow(df)){ 9 | this_aut <- df[i, ] 10 | addthis <- paste0(c( 11 | name = paste(this_aut["first"], this_aut["last"]), 12 | affiliation = gsub(", ", "\n", paste0(this_aut[grepl("^X(\\.\\d)?$", names(this_aut))], collapse = "; "), fixed = TRUE), 13 | address = tryCatch(unname(this_aut["address"]), error = function(e){""}), 14 | email = paste0("\\href{mailto:", this_aut["email"], "}{\\nolinkurl{", this_aut["email"], "}}") 15 | )[!this_aut[c("first", "X", "address", "email")] == ''], collapse = "\\\\\n") 16 | out <- paste0(out, addthis, sep = "\\\\\\\\\n") 17 | } 18 | cat(out) 19 | 20 | 21 | aut <- lapply(1:nrow(df), function(i){ 22 | #i=1 23 | this_aut <- df[i, ] 24 | out <- c( 25 | name = paste(this_aut["first"], this_aut["last"]), 26 | affiliation = paste0(this_aut[grepl("^X(\\.\\d)?$", names(this_aut))], collapse = "; "), 27 | address = tryCatch(unname(this_aut["address"]), error = function(e){""}), 28 | email = unname(this_aut["email"]) 29 | ) 30 | out[!out==""] 31 | }) 32 | 33 | cat(yaml::as.yaml(aut)) 34 | aff <- df[, 6:ncol(df)] 35 | 36 | unique_aff <- as.vector(t(as.matrix(aff))) 37 | unique_aff <- unique_aff[!unique_aff == ""] 38 | unique_aff <- unique_aff[!duplicated(unique_aff)] 39 | 40 | df$institution <- apply(aff, 1, function(x){ 41 | paste(which(unique_aff %in% unlist(x)), collapse = ",") 42 | }) 43 | df$name <- paste(df[[1]], df[[2]]) 44 | names(df) 45 | aut <- df[, c("name", "institution", "corresponding", "address", "email")] 46 | names(aut) <- paste0(" ", names(aut)) 47 | names(aut)[1] <- " - name" 48 | 49 | aut <- do.call(c, lapply(1:nrow(aut), function(x){ 50 | tmp <- aut[x, ] 51 | tmp <- tmp[, !tmp == "", drop = FALSE] 52 | out <- paste0(names(tmp), ': "', tmp, '"') 53 | gsub('\\"yes\\"', "yes", out) 54 | })) 55 | print(cat("\n", aut, "", sep = "\n")) 56 | cat("\n", aut, "", sep = "\n") 57 | -------------------------------------------------------------------------------- /paper/camera_ready.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/camera_ready.zip -------------------------------------------------------------------------------- /paper/camera_ready/README.txt: -------------------------------------------------------------------------------- 1 | As requested, this .zip file contains: 2 | 3 | >> 1. Your complete paper as a .pdf file, formatted using the journal 4 | >> template 5 | 6 | This is the document "preprint.pdf". The accompanying files "preprint.Rmd" and "preprint.tex" are the source files for this document. 7 | 8 | >> 2. The main source file in the form of an .html file (for HTML 9 | >> submissions), a .tex file (for LaTeX submissions), or a .doc/.docx 10 | >> file (for Word submissions) 11 | 12 | This is the document "Manuscript_DS.html". The accompanying file "Manuscript_DS.Rmd" is the source file for this document. 13 | 14 | >> 3. All other source files required for producing the final paper, 15 | >> including image files for figures, .bib and .cls f iles for LaTeX 16 | >> submissions, and .js and .css files for HTML submissions 17 | 18 | The file "worcs.bib" contains all references. The html file "Manuscript_DS.html" is self-contained, but the file "workflow.png" and its source file "workflow.ai" are provided just in case. 19 | 20 | >> 4. A text file with responses to the reviewers 21 | 22 | There are no further reviewer comments. -------------------------------------------------------------------------------- /paper/camera_ready/workflow.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/camera_ready/workflow.ai -------------------------------------------------------------------------------- /paper/camera_ready/workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/camera_ready/workflow.png -------------------------------------------------------------------------------- /paper/connect_rstudio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/connect_rstudio.png -------------------------------------------------------------------------------- /paper/create_git_repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/create_git_repo.png -------------------------------------------------------------------------------- /paper/eadp.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/eadp.pptx -------------------------------------------------------------------------------- /paper/fair/fair_notes.txt: -------------------------------------------------------------------------------- 1 | PsychDS 2 | Bins neuroscience 3 | 4 | -------------------------------------------------------------------------------- /paper/fair/notes fair.txt: -------------------------------------------------------------------------------- 1 | Fellow FAIR data; Rens 2 | Fellow open software: Herbert 3 | 4 | Annemiek van der Kuil: Digitale guide how to make your data FAIR 5 | Johan Holtkuile 6 | Menno Rasch 7 | https://www.uu.nl/en/research/research-data-management/guides/how-to-make-your-data-fair 8 | 9 | Data managers community 10 | 11 | Presentatie bij OS fellows en bij Data Managers community 12 | 13 | RDM support is partner 14 | -------------------------------------------------------------------------------- /paper/jsslogo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/jsslogo.jpg -------------------------------------------------------------------------------- /paper/rdm notes.txt: -------------------------------------------------------------------------------- 1 | Data management plan 2 | 3 | Folder / file naming conventions 4 | Version control 5 | Metadata & documentation 6 | 7 | Describe structure and files in README file 8 | 9 | Reproducible code and data workshop RDM 10 | 11 | Metadata: Structured data providing information about aspects of the data 12 | Documentation: A readme file providing information on aspects of the data 13 | 14 | dcc.ac.uk/resources/metadata-standards 15 | 16 | https://library.stanford.edu/research/data-management-services/data-best-practices/creating-metadata/metadata-tools 17 | 18 | datacite is used for yoda https://schema.datacite.org/ 19 | 20 | Message by Felix-Maina, M.W. (Mary) 21 | Felix-Maina, M.W. (Mary)11:49 AM 22 | https://www.dublincore.org/specifications/dublin-core/dces/ 23 | 24 | "if metadata is not necessary to test your hypotheses, leave it out" 25 | 26 | Data loss/ deterioration 27 | Lots of copies keeps shit safe 28 | 29 | -------------------------------------------------------------------------------- /paper/reviews_ds.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/reviews_ds.pdf -------------------------------------------------------------------------------- /paper/rticles_formats.R: -------------------------------------------------------------------------------- 1 | 2 | write.table(getNamespaceExports("rticles"), "clipboard", sep = "\r\n", quote = F, row.names = F, col.names= F) 3 | 4 | 5 | rticles_formats <- eval(parse(text = 'structure(list(Function = c("ams_article", "asa_article", "biometrics_article", 6 | "copernicus_article", "ctex", "elsevier_article", "frontiers_article", 7 | "ieee_article", "joss_article", "jss_article", "mdpi_article", 8 | "mnras_article", "oup_article", "peerj_article", "plos_article", 9 | "pnas_article", "rjournal_article", "rsos_article", "sage_article", 10 | "sim_article", "springer_article", "tf_article"), Description = c("AMS articles", 11 | "The American Statistican (TAS)", "Biometrics articles", "Copernicus Publications journal submissions", 12 | "CTeX documents", "Elsevier journal submissions", "Frontiers articles", 13 | "IEEE Transaction journal submissions", "JOSS and JOSE articles", 14 | "JSS articles", "MDPI journal submissions", "Monthly Notices of the Royal Astronomical Society articles", 15 | "OUP articles", "PeerJ articles", "PLOS journals", "PNAS journals", 16 | "The R Journal articles", "Royal Society Open Science journal submissions", 17 | "Sage journal submissions", "Statistics in Medicine journal submissions", 18 | "Springer journal submissions", "Taylor & Francis articles")), class = "data.frame", row.names = c(NA, 19 | -22L))')) 20 | 21 | -------------------------------------------------------------------------------- /paper/update_documentation.R: -------------------------------------------------------------------------------- 1 | # Include in makefile: Rscript -e 'source("paper/update_documentation.R") 2 | txt <- readLines("vignettes/workflow.Rmd") 3 | txt <- txt[grepl(".*$)", "", txt) 5 | txt <- gsub("^#", "", txt) 6 | out <- vector("character") 7 | for(i in seq_along(txt)){ 8 | if(startsWith(txt[i], "#")){ 9 | out <- append(out, c("", txt[i], "")) 10 | } else { 11 | out <- append(out, txt[i]) 12 | } 13 | } 14 | 15 | readme <- readLines("inst/rstudio/templates/project/resources/README.md") 16 | readme <- readme[-c(which(startsWith(readme, "## WORCS: Steps to follow for a project"))+1:length(readme))] 17 | readme <- append(readme, out) 18 | 19 | worcs:::write_as_utf(readme, "inst/rstudio/templates/project/resources/README.md") 20 | 21 | # reorder_numbers <- function(txt = readClipboard()){ 22 | # num_line <- which(grepl("^\\d{1,}\\.", txt)) 23 | # for(i in seq_along(num_line)){ 24 | # this_line <- txt[num_line[i]] 25 | # the_num <- as.numeric(strsplit(this_line, "\\.")[[1]][1]) 26 | # if(!the_num == i){ 27 | # txt[num_line[i]] <- gsub(paste0("^", the_num), i, txt[num_line[i]]) 28 | # } 29 | # } 30 | # txt 31 | # } 32 | 33 | -------------------------------------------------------------------------------- /paper/worcs_badge.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/worcs_badge.ai -------------------------------------------------------------------------------- /paper/worcs_badge2.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/worcs_badge2.ai -------------------------------------------------------------------------------- /paper/worcs_badge3.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/worcs_badge3.ai -------------------------------------------------------------------------------- /paper/worcs_badge4.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/worcs_badge4.ai -------------------------------------------------------------------------------- /paper/worcs_badge5.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/worcs_badge5.ai -------------------------------------------------------------------------------- /paper/worcs_banner.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/worcs_banner.ai -------------------------------------------------------------------------------- /paper/worcs_nobanner.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/worcs_nobanner.ai -------------------------------------------------------------------------------- /paper/workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/workflow.png -------------------------------------------------------------------------------- /paper/workflow_graph/Attribution_for_images.txt: -------------------------------------------------------------------------------- 1 | Git logo: 2 | This license lets others distribute, remix, tweak, and build upon your work, even commercially, as long as they credit you for the original creation. This is the most accommodating of the CC licenses offered. Recommended for maximum dissemination and use of licensed materials. 3 | Cloud icon: 4 | Icons made by Freepik from www.flaticon.com 5 | Fix icon: 6 | Icons made by Freepik from www.flaticon.com 7 | Exam icon: 8 | Icons made by surang from www.flaticon.com 9 | Review icon: 10 | Icons made by Freepik from www.flaticon.com 11 | Microsoft excel: 12 | Icons made by Pixel perfect from www.flaticon.com 13 | Camera: 14 | Icons made by Good Ware from www.flaticon.com 15 | PDF: 16 | Icons made by Freepik from www.flaticon.com 17 | Book: 18 | Wanicon on flaticon.com 19 | Speech bubble: 20 | Icons made by Freepik from www.flaticon.com -------------------------------------------------------------------------------- /paper/workflow_graph/Git-Icon-Black.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/workflow_graph/Git-Icon-Black.eps -------------------------------------------------------------------------------- /paper/workflow_graph/Git-Icon-Black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/workflow_graph/Git-Icon-Black.png -------------------------------------------------------------------------------- /paper/workflow_graph/WORCS-open-brightgreen.svg: -------------------------------------------------------------------------------- 1 | WORCSWORCSopenopen -------------------------------------------------------------------------------- /paper/workflow_graph/camera.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /paper/workflow_graph/clock.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /paper/workflow_graph/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/workflow_graph/cloud.png -------------------------------------------------------------------------------- /paper/workflow_graph/cloud.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /paper/workflow_graph/email.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /paper/workflow_graph/exam.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /paper/workflow_graph/fiver feedback.txt: -------------------------------------------------------------------------------- 1 | Text: 2 | - Make sure text is properly aligned; there is a lot of variability in alignment across all the boxes 3 | - Fix spelling; there are some errors that (I believe) were not present in the original 4 | - Capitalization should be consistent across boxes 5 | - The words open_data(), closed_data(), @essential, and @@non-essential should be formatted in a monospaced font (these are code) 6 | - Phase 3 text should not have a newline beginning with "/". It is OK to remove this, or fix in another way 7 | 8 | Icons: 9 | - Icons should be scaled to have visually similar sizes 10 | - Icon for Git remote repository should reflect the fact that this "comes from the cloud", similar to the cloud upload icon, this could be a cloud download icon 11 | - Icon for preregistration and manuscript should be the same, and ideally, this icon should represent the fact that these are .Rmd files 12 | - Use some kind of icon for citation; this might be a useful starting point: https://berserkon.com/img/startdownload?foreign=citation-clipart.jpg 13 | - The icon for "Analysis script" does not make sense. It shows a checklist, but this script will be a computer code document. 14 | - The icon for "Submit to journal" does not make sense. It shows a checklist, but a book icon would make more sense. 15 | - I like the dependency management icon you chose; could you replace the lens of the camera icon with a smaller version of this icon so it's clear that these dependencies are being "snapshot"? 16 | 17 | Overall: 18 | - The arrow from "Dependency management" should point the other way 19 | - Several of the boxes are optional. This should be indicated by a visually distinct element (e.g., my original draft used dashed lines to indicate these, but you can use something different if that looks better) 20 | - Show continuity from the big blue WORCS icon, down through the Git icon, to the finished project. It is important that the graph illustrates how this project progresses over time -------------------------------------------------------------------------------- /paper/workflow_graph/microsoft-excel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /paper/workflow_graph/osf_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/workflow_graph/osf_black.png -------------------------------------------------------------------------------- /paper/workflow_graph/pdf.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /paper/workflow_graph/review.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /paper/workflow_graph/revisions2: -------------------------------------------------------------------------------- 1 | Dear sir, 2 | 3 | Thank you for your revisions. This version is improved from the previous one. I would still like to ask you for several essential improvements: 4 | 5 | Text: 6 | - "Open_data ()" should be "open_data()" 7 | - remate should be remote 8 | - There is a literal " behind '@essential"' 9 | - The word "Cite" should be in normal font (not monospaced). In addition, I would suggest replacing the second "Cite" with "or", to make space for a different icon. 10 | 11 | Icons: 12 | - Publish preprint icon is well-chosen; however, it has a different stroke / line size than the other icons, causing it to look gray in the rasterized version 13 | - Use the icon from "preregistration" (top right) for "manuscript" as well; the text placement of "RMD" is better in the "preregistration" icon 14 | - Please use "worcs_banner.ai" for the bottom row (Phase 3). The file was in the ZIP I sent you. This is a new request, but I think it would look better. 15 | - The "Submit to journal" icon looks like a diary, not an academic journal. Also, the pen suggests that it is not yet finished. Instead, I would simply suggest a book icon like this: https://www.flaticon.com/free-icon/book_2421033?term=book&page=1&position=53 16 | - The "@" icon for citation has not changed based on my previous comment, so I will give some more concrete direction. I would suggest the following: 17 | * Take the first bubble (with the @ symbol) from this icon: https://www.flaticon.com/free-icon/chat_2950630?term=speech%20bubble&page=1&position=26 18 | * Add " marks in the top right corner, so it looks a bit similar to this (copyrighted) icon: https://stock.adobe.com/images/id/99043967?as_campaign=Flaticon&as_content=api&as_audience=srp&tduid=e60be9377eb6e9fc04635b5073a3a08d&as_channel=affiliate&as_campclass=redirect&as_source=arvato 19 | 20 | Flowchart: 21 | - Arrows from "Create git remote repository" and "dependency management" are in a different style from the other arrows 22 | - Arrow from "Add badge" to "Snapshot dependencies" should not be there; both should point to the "Finished project" 23 | - Some of the connectors are not centered on the boxes; extreme example: Top right "add preregistration", the connector is almost at the top of the box. Maybe the same problem occurs for other boxes? 24 | 25 | -------------------------------------------------------------------------------- /paper/workflow_graph/rmd.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /paper/workflow_graph/workflow.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/workflow_graph/workflow.ai -------------------------------------------------------------------------------- /paper/workflow_graph/workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/workflow_graph/workflow.png -------------------------------------------------------------------------------- /paper/workflow_graph/workflow.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/workflow_graph/workflow.vsdx -------------------------------------------------------------------------------- /paper/workflow_graph/workflow_cj.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/paper/workflow_graph/workflow_cj.ai -------------------------------------------------------------------------------- /pkgdown/extra.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --incorrect: #983E82; 3 | --incorrect_alpha: #edaddd; 4 | --correct: #59935B; 5 | --correct_alpha: #c0edc2; 6 | --highlight: #467AAC; 7 | } 8 | 9 | .webex-check {} 10 | 11 | .webex-box { 12 | border: 2px solid var(--highlight); 13 | padding: 0.5em 0.25em; 14 | margin: 1em 0; 15 | border-radius: .25em; 16 | background-color: rgba(127, 127, 127, 0.05); 17 | } 18 | 19 | .webex-total_correct { 20 | margin-left: 1em; 21 | } 22 | 23 | .unchecked .webex-total_correct { 24 | display: none; 25 | } 26 | 27 | .unchecked .webex-incorrect, 28 | .unchecked .webex-correct { 29 | border: 2px dotted grey !important; 30 | background-color: white !important; 31 | } 32 | 33 | /* styles for webex-solveme */ 34 | .webex-select, input.webex-solveme, 35 | .unchecked .webex-radiogroup label.webex-incorrect, 36 | .unchecked .webex-radiogroup label.webex-correct{ 37 | border: 2px dotted grey; 38 | background-color: white; 39 | border-radius: 0.25em; 40 | } 41 | 42 | .webex-incorrect, 43 | input.webex-solveme.webex-incorrect, 44 | .webex-radiogroup label.webex-incorrect { 45 | border: 2px dotted var(--incorrect); 46 | background-color: var(--incorrect_alpha); 47 | color: black; 48 | border-radius: 0.25em; 49 | } 50 | .webex-correct, 51 | input.webex-solveme.webex-correct, 52 | .webex-radiogroup label.webex-correct { 53 | border: 2px solid var(--correct); 54 | background-color: var(--correct_alpha); 55 | color: black; 56 | border-radius: 0.25em; 57 | } 58 | 59 | .unchecked .webex-incorrect span::before, 60 | .unchecked .webex-incorrect + .webex-icon::after, 61 | .unchecked .webex-correct span::before, 62 | .unchecked .webex-correct + .webex-icon::after { 63 | content: " "; 64 | } 65 | 66 | .webex-incorrect span::before, 67 | .webex-incorrect + .webex-icon::after { 68 | content: "\274C "; 69 | } 70 | 71 | .webex-correct span::before, 72 | .webex-correct + .webex-icon::after { 73 | content: "\2705 "; 74 | } 75 | 76 | 77 | /* styles for hidden solutions */ 78 | .webex-solution { 79 | height: 2.5em; 80 | overflow-y: hidden; 81 | padding: 0.5em; 82 | margin-bottom: 10px; 83 | } 84 | .webex-solution.open { 85 | height: auto; 86 | border: 2px solid var(--highlight); 87 | border-radius: 5px; 88 | } 89 | .webex-solution button, .webex-check-button { 90 | height: 2em; 91 | margin-bottom: 0.5em; 92 | border-radius: 0.5em; 93 | background-color: var(--highlight); 94 | color: white; 95 | padding: 0 0.5em; 96 | } 97 | .webex-solution pre.sourceCode { 98 | border-color: var(--correct); 99 | } 100 | 101 | .webex-radiogroup label { 102 | margin-left: 2em; 103 | text-indent: -1em; 104 | padding-left: 0.5em; 105 | font-weight: 400; 106 | display: block; 107 | border: 2px solid rgba(255, 255, 255, 0); 108 | background-color: inherit; 109 | border-radius: 0.25em; 110 | } 111 | 112 | .webex-radiogroup label input { 113 | position: relative; 114 | left: -1em; 115 | } 116 | 117 | .webex-radiogroup { 118 | margin: 1em 0; 119 | } 120 | 121 | -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/pkgdown/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/pkgdown/favicon/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/pkgdown/favicon/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/pkgdown/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/pkgdown/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/pkgdown/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/pkgdown/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/pkgdown/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /repro.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/repro.ai -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(worcs) 3 | 4 | test_check("worcs") 5 | -------------------------------------------------------------------------------- /tests/testthat/test-add_manuscript.R: -------------------------------------------------------------------------------- 1 | test_that("manuscript can be generated", { 2 | library(rticles) 3 | the_test <- "manuscript" 4 | old_wd <- getwd() 5 | test_dir <- file.path(tempdir(), the_test) 6 | dir.create(test_dir) 7 | setwd(test_dir) 8 | file.create(file.path(tempdir(), the_test, ".worcs")) 9 | on.exit(unlink(test_dir, recursive = TRUE), add = TRUE) 10 | 11 | add_manuscript( 12 | worcs_directory = ".", 13 | manuscript = "github_document", 14 | remote_repo = "https" 15 | ) 16 | expect_true(dir.exists("manuscript")) 17 | expect_true(file.exists(".worcs")) 18 | #expect_true(file.exists("manuscript/american-chemical-society.csl")) 19 | expect_true(file.exists("manuscript/manuscript.Rmd")) 20 | expect_true(file.exists("manuscript/references.bib")) 21 | setwd(old_wd) 22 | }) 23 | 24 | test_that("rticles manuscript can be generated", { 25 | library(rticles) 26 | the_test <- "manuscript" 27 | old_wd <- getwd() 28 | test_dir <- file.path(tempdir(), the_test) 29 | dir.create(test_dir) 30 | setwd(test_dir) 31 | file.create(file.path(tempdir(), the_test, ".worcs")) 32 | on.exit(unlink(test_dir, recursive = TRUE), add = TRUE) 33 | 34 | add_manuscript( 35 | worcs_directory = ".", 36 | manuscript = "plos_article", 37 | remote_repo = "https" 38 | ) 39 | expect_true(dir.exists("manuscript")) 40 | expect_true(file.exists(".worcs")) 41 | #expect_true(file.exists("manuscript/american-chemical-society.csl")) 42 | expect_true(file.exists("manuscript/manuscript.Rmd")) 43 | expect_true(file.exists("manuscript/references.bib")) 44 | setwd(old_wd) 45 | }) 46 | 47 | if(requireNamespace("papaja", quietly = TRUE)){ 48 | test_that("papaja manuscript can be generated", { 49 | 50 | the_test <- "manuscript" 51 | old_wd <- getwd() 52 | test_dir <- file.path(tempdir(), the_test) 53 | dir.create(test_dir) 54 | setwd(test_dir) 55 | file.create(file.path(tempdir(), the_test, ".worcs")) 56 | on.exit(unlink(test_dir, recursive = TRUE), add = TRUE) 57 | 58 | add_manuscript( 59 | worcs_directory = ".", 60 | manuscript = "APA6", 61 | remote_repo = "https" 62 | ) 63 | expect_true(dir.exists("manuscript")) 64 | expect_true(file.exists(".worcs")) 65 | #expect_true(file.exists("manuscript/american-chemical-society.csl")) 66 | expect_true(file.exists("manuscript/manuscript.Rmd")) 67 | expect_true(file.exists("manuscript/references.bib")) 68 | setwd(old_wd) 69 | }) 70 | } 71 | -------------------------------------------------------------------------------- /tests/testthat/test-add_preregistration.R: -------------------------------------------------------------------------------- 1 | test_that("preregistration can be generated", { 2 | the_test <- "preregistration" 3 | old_wd <- getwd() 4 | test_dir <- file.path(tempdir(), the_test) 5 | dir.create(test_dir) 6 | setwd(test_dir) 7 | file.create(file.path(tempdir(), the_test, ".worcs")) 8 | on.exit(unlink(test_dir, recursive = TRUE), add = TRUE) 9 | 10 | add_preregistration( 11 | worcs_directory = ".", 12 | preregistration = "vantveer_prereg" 13 | ) 14 | expect_true(file.exists(".worcs")) 15 | #expect_true(file.exists("manuscript/american-chemical-society.csl")) 16 | expect_true(file.exists("preregistration.Rmd")) 17 | file.remove("preregistration.Rmd") 18 | add_preregistration( 19 | worcs_directory = ".", 20 | preregistration = "pss" 21 | ) 22 | expect_true(file.exists("preregistration.Rmd")) 23 | setwd(old_wd) 24 | }) 25 | -------------------------------------------------------------------------------- /tests/testthat/test-can_clone.R: -------------------------------------------------------------------------------- 1 | if(worcs:::gert_works()){ 2 | test_that("gert can clone repos", { 3 | the_test <- "gert_clone" 4 | old_wd <- getwd() 5 | test_dir <- file.path(tempdir(), the_test) 6 | dir.create(test_dir) 7 | setwd(test_dir) 8 | on.exit({setwd(old_wd); unlink(test_dir, recursive = TRUE)}, add = TRUE) 9 | 10 | gert::git_clone("https://github.com/cjvanlissa/actions.git", path = test_dir) 11 | # gert::git_init(path = test_dir) 12 | # if(isFALSE(gert::user_is_configured())){ 13 | # gert::git_config_set(name = "user.name", value = "testuser", repo = ".") 14 | # gert::git_config_set(name = "user.email", value = "c.j.vanlissa@tilburguniversity.edu", repo = ".") 15 | # } 16 | expect_true(file.exists("worcs_reproduce.yaml")) 17 | }) 18 | } 19 | 20 | -------------------------------------------------------------------------------- /tests/testthat/test-check_worcs_installation.R: -------------------------------------------------------------------------------- 1 | test_that("check_worcs_installation() runs", { 2 | expect_error(check_worcs_installation(), NA) 3 | }) 4 | -------------------------------------------------------------------------------- /tests/testthat/test-checksum_git_nogit.R: -------------------------------------------------------------------------------- 1 | if(worcs:::gert_works()){ 2 | test_that("checksum is consistent if git repository is lost", { 3 | the_test <- "cs_git" 4 | old_wd <- getwd() 5 | test_dir <- file.path(tempdir(), the_test) 6 | dir.create(test_dir) 7 | setwd(test_dir) 8 | worcs:::write_worcsfile(file.path(test_dir, ".worcs")) 9 | on.exit({setwd(old_wd); unlink(test_dir, recursive = TRUE)}, add = TRUE) 10 | 11 | writeLines("test my checksummmm", "test.txt") 12 | pdf("binary_file.pdf") 13 | plot(rnorm(20)) 14 | dev.off() 15 | # Set git stuff 16 | gert::git_init(path = test_dir) 17 | if(isFALSE(gert::user_is_configured())){ 18 | gert::git_config_set(name = "user.name", value = "testuser", repo = ".") 19 | gert::git_config_set(name = "user.email", value = "c.j.vanlissa@tilburguniversity.edu", repo = ".") 20 | } 21 | gert::git_add(".") 22 | gert::git_commit("first commit") 23 | # worcs:::cs_fun("test.txt") 24 | # digest::digest("test.txt", file = TRUE) 25 | old_cs <- "ce90b657e51cfe8755ed4936f129642f" 26 | old_cs_binary <- digest::digest("binary_file.pdf", file = TRUE) 27 | expect_true(worcs:::cs_fun("test.txt") == old_cs) 28 | expect_true(worcs:::cs_fun("binary_file.pdf") == old_cs_binary) 29 | 30 | # Remove git repo 31 | system2("rm", "-fr .git") 32 | expect_true(suppressMessages(worcs:::cs_fun("test.txt")) == old_cs) 33 | expect_true(suppressMessages(worcs:::cs_fun("binary_file.pdf")) == old_cs_binary) 34 | }) 35 | } 36 | 37 | -------------------------------------------------------------------------------- /tests/testthat/test-checksum_line_endings.R: -------------------------------------------------------------------------------- 1 | if(worcs:::gert_works()){ 2 | library(gert) 3 | library(digest) 4 | test_that("checksum handles different line endings", { 5 | the_test <- "cs_line_endings" 6 | old_wd <- getwd() 7 | test_dir <- file.path(tempdir(), the_test) 8 | dir.create(test_dir) 9 | setwd(test_dir) 10 | worcs:::write_worcsfile(file.path(test_dir, ".worcs")) 11 | on.exit(unlink(test_dir, recursive = TRUE), add = TRUE) 12 | 13 | txt <- c("Lorem ipsum dolor sit amet,", "consectetur adipiscing elit,", "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.") 14 | writeLines(txt, "slashn.txt", sep = "\n") 15 | writeLines(txt, "slashr.txt", sep = "\r") 16 | writeLines(txt, "slashrn.txt", sep = "\r\n") 17 | 18 | cs_correct <- "fabfeae70e2b9b605e5edd1e232d4b3a" 19 | 20 | cs_n <- worcs:::cs_fun("slashn.txt") 21 | cs_r <- worcs:::cs_fun("slashr.txt") 22 | cs_rn <- worcs:::cs_fun("slashrn.txt") 23 | 24 | expect_true(cs_n == cs_correct) 25 | 26 | expect_true(cs_r == cs_correct) 27 | 28 | expect_true(cs_rn == cs_correct) 29 | 30 | 31 | # With git ---------------------------------------------------------------- 32 | 33 | gert::git_init(path = test_dir) 34 | if(!gert::user_is_configured(repo = test_dir)){ 35 | gert::git_config_set("user.name", "Jerry", repo = test_dir) 36 | gert::git_config_set("user.email", "jerry@gmail.com", repo = test_dir) 37 | } 38 | gert::git_add(".", repo = test_dir) 39 | gert::git_commit("first commit", repo = test_dir) 40 | 41 | cs_n <- worcs:::cs_fun("slashn.txt") 42 | cs_r <- worcs:::cs_fun("slashr.txt") 43 | cs_rn <- worcs:::cs_fun("slashrn.txt") 44 | 45 | expect_true(cs_n == cs_correct) 46 | 47 | expect_true(cs_r == cs_correct) 48 | 49 | expect_true(cs_rn == cs_correct) 50 | 51 | 52 | # Compare to digest ------------------------------------------------------- 53 | 54 | expect_true(!(cs_r == digest::digest("slashr.txt", file = TRUE))) 55 | expect_true(!(cs_n == digest::digest("slashn.txt", file = TRUE))) 56 | expect_true(!(cs_rn == digest::digest("slashrn.txt", file = TRUE))) 57 | 58 | setwd(old_wd) 59 | }) 60 | } 61 | -------------------------------------------------------------------------------- /tests/testthat/test-checksum_markdown.R: -------------------------------------------------------------------------------- 1 | test_that("checksum works from within Rmarkdown", { 2 | 3 | skip_if_not_pandoc("2.0") 4 | scoped_temporary_project() 5 | test_dir = "." 6 | worcs:::write_worcsfile(file.path(test_dir, ".worcs")) 7 | dat <- iris[1:4,1:4] 8 | open_data(dat) 9 | cs_correct <- read_yaml(".worcs")$checksums[["dat.csv"]] 10 | 11 | expect_true(worcs:::cs_fun(filename = file.path(test_dir, "dat.csv")) == cs_correct) 12 | 13 | dir.create(file.path(test_dir, "manuscript")) 14 | setwd(file.path(test_dir, "manuscript")) 15 | 16 | # expect_true(worcs:::cs_fun(filename = file.path(test_dir, "dat.csv"), worcsfile = file.path(test_dir, ".worcs")) == cs_correct) 17 | # 18 | man_txt <- c("---", "title: \"Untitled\"", "output: github_document", "---", 19 | "", "```{r setup}", "library(\"worcs\")", "load_data()", "```", "", "`r worcs:::cs_fun(file.path(dirname(worcs:::check_recursive(file.path(normalizePath('.')))), 'dat.csv'))`") 20 | writeLines(man_txt, "manuscript.Rmd") 21 | rmarkdown::render("manuscript.Rmd") 22 | md_checksum <- tail(readLines("manuscript.md"), 1) 23 | expect_true(md_checksum == cs_correct) 24 | 25 | }) 26 | 27 | -------------------------------------------------------------------------------- /tests/testthat/test-codebook.R: -------------------------------------------------------------------------------- 1 | test_that("codebook works for iris", { 2 | if (rmarkdown::pandoc_available("2.0")){ 3 | old_wd <- getwd() 4 | test_dir <- file.path(tempdir(), "codebook") 5 | dir.create(test_dir) 6 | setwd(test_dir) 7 | data("iris") 8 | worcs::make_codebook(iris) 9 | 10 | expect_true(file.exists("codebook.Rmd")) 11 | 12 | expect_true(file.exists("codebook.md")) 13 | 14 | expect_true(file.exists("codebook.csv")) 15 | contents <- readLines("codebook.Rmd", encoding = "UTF-8") 16 | expect_true(any(contents == "The data contains 150 cases and 5 variables.")) 17 | 18 | setwd(old_wd) 19 | unlink(test_dir, recursive = TRUE) 20 | } 21 | }) 22 | 23 | if(TRUE){ 24 | test_that("codebook works for PlantGrowth with missings", { 25 | if (rmarkdown::pandoc_available("2.0")){ 26 | df <- CO2 27 | df[c(7:8), 1] <- NA 28 | df[c(1, 25), 2] <- NA 29 | 30 | old_wd <- getwd() 31 | test_dir <- file.path(tempdir(), "codebook") 32 | dir.create(test_dir) 33 | setwd(test_dir) 34 | 35 | worcs::make_codebook(df) 36 | expect_true(file.exists("codebook.Rmd")) 37 | 38 | expect_true(file.exists("codebook.md")) 39 | 40 | 41 | contents <- readLines("codebook.Rmd", encoding = "UTF-8") 42 | 43 | expect_true(any(contents == "The data contains 84 cases and 5 variables.")) #"The data contains 30 cases and 2 variables.")) 44 | 45 | setwd(old_wd) 46 | unlink(test_dir, recursive = TRUE) 47 | } 48 | }) 49 | } 50 | -------------------------------------------------------------------------------- /tests/testthat/test-descriptives.R: -------------------------------------------------------------------------------- 1 | data("iris") 2 | tmp <- descriptives(iris) 3 | 4 | test_that("descriptives creates correct output", { 5 | expect_true(all(c("n", "missing", "unique", "mean", "median", "mode", "mode_value", 6 | "sd", "v", "min", "max", "range", "skew", "skew_2se", "kurt", 7 | "kurt_2se") %in% names(tmp))) 8 | num_vars <- sapply(iris, class) == "numeric" 9 | num_cols <- c("n", "missing", "unique", "mean", "median", "mode", "sd", "min", "max", "range", "skew", "skew_2se", "kurt", "kurt_2se") 10 | expect_true(all(!is.na(tmp[num_vars, num_cols]))) 11 | 12 | fac_cols <- c("n", "missing", "unique", "mode", "mode_value", "v") 13 | expect_true(all(!is.na(tmp[!num_vars, fac_cols]))) 14 | 15 | expect_true(all(is.na(tmp[num_vars, c("mode_value", "v")]))) 16 | expect_true(all(is.na(tmp[!num_vars, c("mean", "median", "sd", "min", "max", "range", "skew", "skew_2se", "kurt", "kurt_2se")]))) 17 | }) 18 | -------------------------------------------------------------------------------- /tests/testthat/test-dir_of_save_data.R: -------------------------------------------------------------------------------- 1 | test_that("data stored in correct dir", { 2 | the_path <- fs::file_temp(pattern = "savedat2") 3 | scoped_temporary_project(dir = the_path) 4 | 5 | file.create(".worcs") 6 | 7 | add_manuscript( 8 | worcs_directory = ".", 9 | manuscript = "github_document", 10 | remote_repo = "https" 11 | ) 12 | data("iris") 13 | df1 <- iris[1:5, 1:4] 14 | closed_data(df1) 15 | withr::with_dir(file.path(the_path, "manuscript"), { 16 | df2 <- iris[10:15, 1:4] 17 | closed_data(df2) 18 | }) 19 | 20 | f <- c("codebook_df1.csv", "codebook_df1.Rmd", "codebook_df2.csv", "codebook_df2.Rmd", "df1.csv", "df2.csv", 21 | "synthetic_df1.csv", "synthetic_df2.csv") 22 | if(isTRUE(pandoc_available("3"))){ 23 | f <- c(f, "codebook_df1.html", "codebook_df1.md", "codebook_df2.html", "codebook_df2.md") 24 | } 25 | 26 | expect_true(all(sapply(f, file.exists))) 27 | expect_true(all(!sapply(file.path("manuscript", f), file.exists))) 28 | 29 | yml <- yaml::read_yaml(".worcs") 30 | expect_true(all(names(yml$data) == paste0("df", 1:2, ".csv"))) 31 | expect_true(all(names(yml$checksums) %in% f)) 32 | 33 | expect_true(tolower(yml$data$df1.csv$synthetic) %in% tolower(f)) 34 | expect_true(tolower(yml$data$df2.csv$synthetic) %in% tolower(f)) 35 | 36 | expect_true(tolower(yml$data$df1.csv$codebook) %in% tolower(f)) 37 | expect_true(tolower(yml$data$df2.csv$codebook) %in% tolower(f)) 38 | 39 | }) 40 | -------------------------------------------------------------------------------- /tests/testthat/test-export_project.R: -------------------------------------------------------------------------------- 1 | # the_test <- "export" 2 | # old_wd <- getwd() 3 | # dir.create(file.path(tempdir(), the_test)) 4 | # setwd(file.path(tempdir(), "citeall")) 5 | 6 | 7 | # 8 | # if(!Sys.info()['sysname'] == "Windows"){ 9 | # if(Sys.getenv("R_ZIPCMD") == ""){ 10 | # library(rtools) 11 | # if(devtools::find_rtools()) Sys.setenv(R_ZIPCMD= file.path(devtools:::dev_sitrep()$rtools_path, "zip")) 12 | # } 13 | # } 14 | 15 | # See if ZIP works at all 16 | run_test <- tryCatch({ 17 | testfile <- tempfile(fileext = ".txt") 18 | writeLines("test me", testfile) 19 | zipfile <- tempfile(fileext = ".zip") 20 | res <- zip(zipfile = zipfile, files = testfile, flags="-jrq") 21 | res == 0 22 | }, error = function(e){FALSE}) 23 | 24 | if(run_test){ 25 | #do.call(git_user, worcs:::get_user()) 26 | test_that("worcs_project can be exported via ZIP", { 27 | scoped_temporary_project() 28 | testdir <- file.path(tempdir(), "zip") 29 | dir.create(testdir) 30 | oldwd <- getwd() 31 | setwd(testdir) 32 | 33 | testdir <- file.path(".") 34 | testzip <- "test.zip" 35 | 36 | suppressWarnings( 37 | worcs_project( 38 | ".", 39 | manuscript = "None", 40 | preregistration = "None", 41 | add_license = "None", 42 | use_renv = FALSE, 43 | remote_repo = NULL 44 | ) 45 | ) 46 | 47 | 48 | expect_true(file.exists(".worcs")) 49 | 50 | result <- export_project(zipfile = testzip, worcs_directory = ".", open_data = FALSE) 51 | 52 | 53 | expect_true(result) 54 | 55 | expect_true(file.exists(testzip)) 56 | }) 57 | 58 | # setwd(old_wd) 59 | #unlink(c(testzip, testdir), recursive = TRUE) 60 | 61 | } 62 | -------------------------------------------------------------------------------- /tests/testthat/test-reproduce.R: -------------------------------------------------------------------------------- 1 | test_that("add_recipe is evaluated by reproduce()", { 2 | the_test <- "reproduce" 3 | old_wd <- getwd() 4 | test_dir <- file.path(tempdir(), the_test) 5 | dir.create(test_dir) 6 | setwd(test_dir) 7 | worcs:::write_worcsfile(file.path(test_dir, ".worcs")) 8 | on.exit({setwd(old_wd); unlink(test_dir, recursive = TRUE)}, add = TRUE) 9 | 10 | add_recipe(recipe = 'writeLines("test", "test.txt")') 11 | reproduce(check_endpoints = FALSE) 12 | expect_true(file.exists("test.txt")) 13 | file.remove(file.path(test_dir, ".worcs")) 14 | worcs:::write_worcsfile(file.path(test_dir, ".worcs")) 15 | 16 | add_recipe(recipe = 'Rscript -e """writeLines("test", "test.txt")"""', terminal = TRUE) 17 | reproduce(check_endpoints = FALSE) 18 | expect_true(file.exists("test.txt")) 19 | 20 | }) 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/testthat/test-save_load_expression.R: -------------------------------------------------------------------------------- 1 | library(yaml) 2 | library(digest) 3 | test_that("save_expression and load_expression", { 4 | the_test <- "save_expression" 5 | old_wd <- getwd() 6 | test_dir <- file.path(tempdir(), the_test) 7 | dir.create(test_dir) 8 | setwd(test_dir) 9 | worcs:::write_worcsfile(file.path(tempdir(), the_test, ".worcs")) 10 | on.exit(unlink(test_dir, recursive = TRUE), add = TRUE) 11 | dat <- iris[1:5, ] 12 | open_data(dat, 13 | filename = "dat.dat", 14 | codebook = NULL, 15 | save_expression = write.table(data, file = filename, row.names = FALSE), 16 | load_expression = read.table(file = filename, header = TRUE, sep = " ", stringsAsFactors = TRUE)) 17 | 18 | 19 | # test_that("loading open data works", { 20 | rm(dat) 21 | expect_error({load_data()}, NA) 22 | suppressWarnings(load_data()) 23 | expect_warning({load_data()}) 24 | 25 | df <- load_data(to_envir = FALSE)$dat 26 | 27 | # test_that("loaded data same as original", { 28 | expect_equivalent(iris[1:5, ], df) 29 | 30 | df <- rbind(df, df[40,]) 31 | write.table(df, file = "dat.dat", row.names = FALSE) 32 | 33 | 34 | # test_that("loading open data fails when data changed", { 35 | expect_warning({load_data()}) 36 | 37 | set.seed(555) 38 | dat <- iris 39 | closed_data(dat, 40 | filename = "dat.dat", 41 | codebook = NULL, 42 | save_expression = write.table(data, file = filename, row.names = FALSE), 43 | load_expression = read.table(file = filename, header = TRUE, sep = " ", stringsAsFactors = TRUE)) 44 | 45 | checksums <- read_yaml(".worcs") 46 | tmp <- read.table(file = "synthetic_dat.dat", header = TRUE, sep = " ", stringsAsFactors = TRUE) 47 | 48 | # test_that("synthetic data similar", { 49 | expect_equivalent(dim(tmp), dim(dat)) 50 | expect_equivalent(sapply(dat, class), sapply(tmp, class)) # read.table is read as character 51 | 52 | # test_that(".worcs contains checksum for synthetic_data.csv", { 53 | expect_true(!is.null(checksums$checksums[["synthetic_dat.dat"]])) 54 | expect_equivalent(checksums$checksums$synthetic_dat.dat, worcs:::cs_fun("synthetic_dat.dat")) 55 | 56 | # test_that("loading open data works", { 57 | rm(dat) 58 | expect_error({load_data()}, NA) 59 | 60 | file.remove("dat.dat") 61 | 62 | df <- load_data(to_envir = FALSE)$dat 63 | 64 | # test_that("loaded synthetic data same as original", { 65 | expect_equivalent(tmp, df) 66 | 67 | setwd(old_wd) 68 | }) 69 | -------------------------------------------------------------------------------- /tests/testthat/test-test-synthetic.R: -------------------------------------------------------------------------------- 1 | if (requireNamespace("missRanger", quietly = TRUE)) { 2 | 3 | library(missRanger) 4 | test_that("Argument missingness_expression works", { 5 | iris_missings <- iris 6 | for(i in 1:10){ 7 | iris_missings[sample.int(nrow(iris_missings), 1, replace = TRUE), 8 | sample.int(ncol(iris_missings), 1, replace = TRUE)] <- NA 9 | } 10 | iris_miss_syn <- synthetic(iris_missings, missingness_expression = missRanger(data = data)) 11 | expect_true(anyNA(iris_miss_syn)) 12 | }) 13 | 14 | } 15 | -------------------------------------------------------------------------------- /tests/testthat/test-worcs_project.R: -------------------------------------------------------------------------------- 1 | if(worcs:::gert_works()){ 2 | library(gert) 3 | test_that("worcs project can be generated", { 4 | 5 | scoped_temporary_project() 6 | 7 | worcs_project( 8 | path = "worcs_project", 9 | manuscript = "github_document", 10 | preregistration = "cos_prereg", 11 | add_license = "ccby", 12 | use_renv = FALSE, 13 | remote_repo = NULL 14 | ) 15 | # list.files() 16 | expect_true(file.exists("worcs_project/.worcs")) 17 | expect_true(file.exists("worcs_project/LICENSE")|file.exists("worcs_project/LICENSE.md")) 18 | expect_true(file.exists("worcs_project/README.md")) 19 | readme_contents <- readLines("worcs_project/README.md", encoding = "UTF-8") 20 | expect_true(any(readme_contents == paste0("You can load this project in RStudio by opening the file called '", "worcs_project.Rproj", "'."))) 21 | expect_true(file.exists("worcs_project/preregistration.Rmd")) 22 | expect_true(file.exists("worcs_project/manuscript/manuscript.Rmd")) 23 | expect_error(git_status(repo = "worcs_project"), NA) 24 | 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /tests/testthat/test-worcsfile.R: -------------------------------------------------------------------------------- 1 | library(yaml) 2 | 3 | Args <- list( 4 | arg1 = "val1", arg2 = list(arg2.1 = "val2.1", arg2.2 = "val2.2"), arg3 = list(arg3.1 = "val3.1", arg3.2 = "val3.2"), arg4 = "hoi" 5 | ) 6 | arg_list <- c(list(filename = "test.yaml"), Args, list(modify = FALSE)) 7 | do.call(worcs:::write_worcsfile, arg_list) 8 | 9 | result <- read_yaml("test.yaml") 10 | 11 | test_that("yaml read correctly", { 12 | expect_true(all(unlist(Args) == unlist(result))) 13 | }) 14 | 15 | worcs:::write_worcsfile("test.yaml", arg4 = "replaced", modify = TRUE) 16 | result <- read_yaml("test.yaml") 17 | modified_args <- Args 18 | modified_args$arg4 <- "replaced" 19 | 20 | test_that("can replace one yaml key/value", { 21 | expect_true(all(unlist(modified_args) == unlist(result))) 22 | }) 23 | 24 | worcs:::write_worcsfile("test.yaml", arg3 = list(arg3.1 = "replaced3.1"), modify = TRUE) 25 | result <- read_yaml("test.yaml") 26 | modified_args$arg3$arg3.1 <- "replaced3.1" 27 | 28 | test_that("can replace one nested yaml key/value", { 29 | expect_true(all(unlist(modified_args) == unlist(result))) 30 | }) 31 | 32 | worcs:::write_worcsfile("test.yaml", arg3 = list(arg3.new = "anewvalue"), modify = TRUE) 33 | result <- read_yaml("test.yaml") 34 | modified_args$arg3$arg3.new <- "anewvalue" 35 | 36 | 37 | test_that("can append one nested yaml key/value", { 38 | expect_true(all(unlist(modified_args) == unlist(result))) 39 | }) 40 | -------------------------------------------------------------------------------- /tests/testthat/test.yaml: -------------------------------------------------------------------------------- 1 | arg1: val1 2 | arg2: 3 | arg2.1: val2.1 4 | arg2.2: val2.2 5 | arg3: 6 | arg3.1: replaced3.1 7 | arg3.2: val3.2 8 | arg3.new: anewvalue 9 | arg4: replaced 10 | -------------------------------------------------------------------------------- /tests/testthat/testthat-problems.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/tests/testthat/testthat-problems.rds -------------------------------------------------------------------------------- /vignettes/citation.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Citing references in worcs" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{Citing references in worcs} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | ```{r, include = FALSE} 11 | knitr::opts_chunk$set( 12 | collapse = TRUE, 13 | comment = "#>" 14 | ) 15 | library(worcs) 16 | ``` 17 | 18 | Comprehensive citation of literature, data, materials, methods, and software 19 | is one of the hallmarks of open science. When using the R-implementation of 20 | WORCS, you will most likely be writing your manuscript in `RMarkdown` format. 21 | This means that you will use Markdown `citekey`s to refer to references, and 22 | these references will be stored in a separate text file known as a `.bib` file. 23 | 24 | To ease this process, we recommend following this procedure for citation: 25 | 26 | 1. During writing, maintain a plain-text `.bib` file with the BibTeX references 27 | for all citations. 28 | + You can export a `.bib` file from most reference manager 29 | programs; the free, open-source reference manager 30 | [Zotero](https://www.zotero.org/download/) is excellent and user-friendly, 31 | and highly interoperable with other commercial reference managers. Searching for "How to Integrate Zotero Citations with R Markdown" will yield tutorials for using Zotero with RMarkdown. 32 | + Alternatively, it is possible to make this file by hand, copy and pasting 33 | each new reference below 34 | the previous one; e.g., Figure \@ref(fig:scholarbib) shows how to obtain a 35 | BibTeX reference from Google Scholar; simply copy-paste each reference into 36 | the `.bib` file 37 | 2. To cite a reference, use the `citekey` - the first word in the BibTeX entry 38 | for that reference. Insert it in the RMarkdown file like so: `@yourcitekey2020`. 39 | For a parenthesized reference, use `[@citekeyone2020; @citekeytwo2020]`. For 40 | more options, see the [RMarkdown cookbook](https://bookdown.org/yihui/rmarkdown-cookbook/bibliography.html). 41 | 3. To indicate a *non-essential* citation, mark it with a double at-symbol: `@@nonessential2020`. 42 | 4. When Knitting the document, adapt the `knit` command in the YAML header. 43 | `knit: worcs::cite_all` renders all citations, and 44 | `knit: worcs::cite_essential` removes all *non-essential* citations. 45 | 5. Optional: To be extremely thorough, you could make a "branch" of the GitHub repository for the print version of the manuscript. Only in this branch, you use the function `knit: worcs::cite_essential`. The procedure is documented in [this tutorial](http://rstudio-pubs-static.s3.amazonaws.com/142364_3b344a38149b465c8ebc9a8cd2eee3aa.html). 46 | 47 | ```{r, scholarbib, echo = FALSE, fig.cap="Exporting a BibTex reference from Google Scholar"} 48 | knitr::include_graphics("scholar_bib.png") 49 | ``` 50 | -------------------------------------------------------------------------------- /vignettes/gh_release.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/vignettes/gh_release.png -------------------------------------------------------------------------------- /vignettes/github_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/vignettes/github_download.png -------------------------------------------------------------------------------- /vignettes/scholar_bib.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/vignettes/scholar_bib.png -------------------------------------------------------------------------------- /vignettes/setup-docker.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Setting up your computer for WORCS - Docker-edition" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{Setting up your computer for WORCS - Docker-edition} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | ```{r, include = FALSE} 11 | knitr::opts_chunk$set( 12 | collapse = TRUE, 13 | comment = "#>" 14 | ) 15 | ``` 16 | 17 | If you do not want to install R, RStudio, Latex and Git on a personal computer (as described in [`vignette("setup", package = "worcs")`](https://cjvanlissa.github.io/worcs/articles/setup.html)), but would like to use Docker instead, follow these steps in order: 18 | 19 | 1. Install [Docker](https://docs.docker.com/get-docker/) 20 | 2. Open a terminal/cmd/shell. 21 | 2. Start the `worcs` image: 22 | 23 | ```{bash, eval=FALSE} 24 | docker run -e PASSWORD=secret -p 8787:8787 -it cjvanlissa/worcs:latest 25 | ``` 26 | 27 | 3. Open the address `127.0.0.1:8787/` in a browser. Login using username=rstudio and password=secret. 28 | 29 | Then setup the container. 30 | 31 | ```{r, eval=FALSE} 32 | renv::consent(provided = TRUE) 33 | worcs::git_user("your_name", "your_email") 34 | ``` 35 | 36 | To terminate the container, press Ctrl + C in the terminal. To save files from a Docker session on your disk, you have to link a directory explicitly when starting the container. 37 | 38 | On Unix file systems, this is done as follows: 39 | 40 | ```{bash, eval=FALSE} 41 | -v /path/on/your/pc:/home/rstudio 42 | ``` 43 | 44 | And on Windows file systems, as follows: 45 | 46 | ```{bash, eval=FALSE} 47 | -v //c/path/on/your/windows/pc:/home/rstudio 48 | ``` 49 | 50 | Then start the Docker session using this command: 51 | 52 | ```{bash, eval=FALSE} 53 | docker run -e PASSWORD=secret -p 8787:8787 -v /path/on/your/pc:/home/rstudio -it cjvanlissa/worcs:latest 54 | ``` 55 | 56 | That's it! 57 | -------------------------------------------------------------------------------- /vignettes/workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjvanlissa/worcs/53d938d259b9c8945e8ebfe9017587466301c5f6/vignettes/workflow.png -------------------------------------------------------------------------------- /worcs.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | ProjectId: 70417f40-6f0e-4cfd-9c89-1ee111aeab12 3 | 4 | RestoreWorkspace: Default 5 | SaveWorkspace: Default 6 | AlwaysSaveHistory: Default 7 | 8 | EnableCodeIndexing: Yes 9 | UseSpacesForTab: Yes 10 | NumSpacesForTab: 2 11 | Encoding: UTF-8 12 | 13 | RnwWeave: Sweave 14 | LaTeX: pdfLaTeX 15 | 16 | AutoAppendNewline: Yes 17 | StripTrailingWhitespace: Yes 18 | 19 | BuildType: Package 20 | PackageUseDevtools: Yes 21 | PackageInstallArgs: --no-multiarch --with-keep.source 22 | PackageCheckArgs: --run-donttest 23 | PackageRoxygenize: rd,collate,namespace 24 | --------------------------------------------------------------------------------