├── .Rbuildignore
├── .github
├── .gitignore
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ ├── add-to-project.yml
│ ├── build.yaml
│ ├── reusable-cran-check.yaml
│ ├── reusable-document.yaml
│ ├── reusable-pkgdown.yaml
│ └── reusable-style.yaml
├── .gitignore
├── .lintr
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── DESCRIPTION
├── LICENSE
├── LICENSE.md
├── NAMESPACE
├── NEWS.md
├── R
├── create_doc.R
├── prodigenr-package.R
├── rstudio_setup.R
├── setup_project.R
├── usethis-utils.R
└── utils.R
├── README.Rmd
├── README.md
├── _pkgdown.yml
├── cran-comments.md
├── inst
├── WORDLIST
├── rstudio
│ └── templates
│ │ └── project
│ │ └── rstudio_setup.dcf
└── templates
│ ├── documents
│ ├── report.qmd
│ └── slides.qmd
│ └── projects
│ └── basic-analysis
│ ├── DESCRIPTION
│ ├── R
│ └── README.md
│ ├── README.md
│ ├── TODO.md
│ ├── data-raw
│ └── README.md
│ ├── data
│ └── README.md
│ ├── docs
│ └── README.md
│ ├── gitignore
│ └── template-Rproj
├── justfile
├── man
├── create_doc.Rd
├── figures
│ └── logo.png
├── prodigenr-package.Rd
├── setup_project.Rd
├── setup_with_git.Rd
└── template_list.Rd
├── pkgdown
└── favicon
│ ├── apple-touch-icon-120x120.png
│ ├── apple-touch-icon-60x60.png
│ ├── apple-touch-icon-76x76.png
│ ├── apple-touch-icon.png
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ └── favicon.ico
├── prodigenr.Rproj
├── revdep
├── .gitignore
├── README.md
├── cran.md
├── failures.md
└── problems.md
├── tests
├── testthat.R
└── testthat
│ ├── test-files.R
│ └── test-projects.R
└── vignettes
└── prodigenr.Rmd
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^.*\.Rproj$
2 | ^\.Rproj\.user$
3 | ^\.travis\.yml$
4 | ^cran-comments\.md$
5 | ^CODE_OF_CONDUCT\.md$
6 | ^CONTRIBUTING\.md$
7 | ^codecov\.yml$
8 | ^_pkgdown\.yml$
9 | ^docs$
10 | ^vignettes/manifesto\.Rmd$
11 | ^pkgdown$
12 | ^appveyor\.yml$
13 | ^LICENSE\.md$
14 | ^README\.Rmd$
15 | ^CRAN-RELEASE$
16 | ^\.github$
17 | ^CRAN-SUBMISSION$
18 | ^justfile$
19 | ^\.lintr$
20 | ^revdep$
21 |
--------------------------------------------------------------------------------
/.github/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Description
2 |
3 | These changes are for PURPOSE, because REASON.
4 |
5 | Closes #
6 |
7 | ## Checklist
8 |
9 | - [ ] Ran `just run-all`
10 | - [ ] If docs were added, Markdown is formatted
11 |
--------------------------------------------------------------------------------
/.github/workflows/add-to-project.yml:
--------------------------------------------------------------------------------
1 | name: Add to project board
2 |
3 | on:
4 | issues:
5 | types:
6 | - opened
7 | - reopened
8 | - transferred
9 | pull_request:
10 | types:
11 | - reopened
12 | - opened
13 |
14 | permissions:
15 | pull-requests: write
16 |
17 | jobs:
18 | add-to-project:
19 | name: Add to project
20 | runs-on: ubuntu-latest
21 | steps:
22 | - name: Add issue or PR to project board
23 | uses: actions/add-to-project@v1.0.2
24 | with:
25 | project-url: https://github.com/orgs/rostools/projects/12
26 | github-token: ${{ secrets.ADD_TO_BOARD }}
27 |
28 | - name: Assign PR to creator
29 | if: ${{ github.event_name == 'pull_request' }}
30 | run: |
31 | gh pr edit $PR --add-assignee $AUTHOR
32 | env:
33 | AUTHOR: ${{ github.event.pull_request.user.login }}
34 | PR: ${{ github.event.pull_request.html_url }}
35 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 |
37 |
38 |
--------------------------------------------------------------------------------
/.github/workflows/build.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
6 | pull_request:
7 | branches: main
8 | release:
9 | types: [published]
10 |
11 | name: Build package
12 |
13 | permissions: read-all
14 |
15 | jobs:
16 | style:
17 | uses: ./.github/workflows/reusable-style.yaml
18 | permissions:
19 | contents: write
20 | secrets:
21 | github-token: ${{ secrets.GITHUB_TOKEN }}
22 |
23 | document:
24 | uses: ./.github/workflows/reusable-document.yaml
25 | needs: style
26 | permissions:
27 | contents: write
28 | secrets:
29 | github-token: ${{ secrets.GITHUB_TOKEN }}
30 |
31 | cran-check:
32 | uses: ./.github/workflows/reusable-cran-check.yaml
33 | needs: document
34 | secrets:
35 | github-token: ${{ secrets.GITHUB_TOKEN }}
36 |
37 | pkgdown:
38 | uses: ./.github/workflows/reusable-pkgdown.yaml
39 | needs: cran-check
40 | permissions:
41 | contents: write
42 | secrets:
43 | github-token: ${{ secrets.GITHUB_TOKEN }}
44 |
--------------------------------------------------------------------------------
/.github/workflows/reusable-cran-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 | workflow_call:
5 | secrets:
6 | github-token:
7 | required: true
8 |
9 | name: Run R CMD checks and tests
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 | build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
51 |
--------------------------------------------------------------------------------
/.github/workflows/reusable-document.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 | workflow_call:
5 | secrets:
6 | github-token:
7 | required: true
8 |
9 | name: Run roxygen2 to build function documentation
10 |
11 | jobs:
12 | document:
13 | runs-on: ubuntu-latest
14 | env:
15 | GITHUB_PAT: ${{ secrets.github-token }}
16 | steps:
17 | - name: Checkout repo
18 | uses: actions/checkout@v4
19 | with:
20 | fetch-depth: 0
21 |
22 | - name: Setup R
23 | uses: r-lib/actions/setup-r@v2
24 | with:
25 | use-public-rspm: true
26 |
27 | - name: Install dependencies
28 | uses: r-lib/actions/setup-r-dependencies@v2
29 | with:
30 | extra-packages: any::roxygen2
31 | needs: roxygen2
32 |
33 | - name: Document
34 | run: roxygen2::roxygenise()
35 | shell: Rscript {0}
36 |
37 | - name: Commit and push changes
38 | run: |
39 | git config --local user.name "$GITHUB_ACTOR"
40 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
41 | git add man/\* NAMESPACE DESCRIPTION
42 | git commit -m "Update documentation" || echo "No changes to commit"
43 | git pull --ff-only
44 | git push origin
45 |
--------------------------------------------------------------------------------
/.github/workflows/reusable-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 | workflow_call:
5 | secrets:
6 | github-token:
7 | required: true
8 |
9 | name: Build the pkgdown website
10 |
11 | jobs:
12 | pkgdown:
13 | runs-on: ubuntu-latest
14 | # Only restrict concurrency for non-PR jobs
15 | concurrency:
16 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
17 | env:
18 | GITHUB_PAT: ${{ secrets.github-token }}
19 | steps:
20 | - uses: actions/checkout@v4
21 |
22 | - uses: r-lib/actions/setup-pandoc@v2
23 |
24 | - uses: r-lib/actions/setup-r@v2
25 | with:
26 | use-public-rspm: true
27 |
28 | - uses: r-lib/actions/setup-r-dependencies@v2
29 | with:
30 | extra-packages: any::pkgdown, local::.
31 | needs: website
32 |
33 | - name: Build site
34 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
35 | shell: Rscript {0}
36 |
37 | - name: Deploy to GitHub pages 🚀
38 | if: github.event_name != 'pull_request'
39 | uses: JamesIves/github-pages-deploy-action@v4.5.0
40 | with:
41 | clean: false
42 | branch: gh-pages
43 | folder: docs
44 |
--------------------------------------------------------------------------------
/.github/workflows/reusable-style.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 | workflow_call:
5 | secrets:
6 | github-token:
7 | required: true
8 |
9 | name: Run styler to reformat R code
10 |
11 | jobs:
12 | style:
13 | runs-on: ubuntu-latest
14 | env:
15 | GITHUB_PAT: ${{ secrets.github-token }}
16 | steps:
17 | - name: Checkout repo
18 | uses: actions/checkout@v4
19 | with:
20 | fetch-depth: 0
21 |
22 | - name: Setup R
23 | uses: r-lib/actions/setup-r@v2
24 | with:
25 | use-public-rspm: true
26 |
27 | - name: Install dependencies
28 | uses: r-lib/actions/setup-r-dependencies@v2
29 | with:
30 | extra-packages: any::styler, any::roxygen2
31 | needs: styler
32 |
33 | - name: Enable styler cache
34 | run: styler::cache_activate()
35 | shell: Rscript {0}
36 |
37 | - name: Determine cache location
38 | id: styler-location
39 | run: |
40 | cat(
41 | "location=",
42 | styler::cache_info(format = "tabular")$location,
43 | "\n",
44 | file = Sys.getenv("GITHUB_OUTPUT"),
45 | append = TRUE,
46 | sep = ""
47 | )
48 | shell: Rscript {0}
49 |
50 | - name: Cache styler
51 | uses: actions/cache@v4
52 | with:
53 | path: ${{ steps.styler-location.outputs.location }}
54 | key: ${{ runner.os }}-styler-${{ github.sha }}
55 | restore-keys: |
56 | ${{ runner.os }}-styler-
57 | ${{ runner.os }}-
58 |
59 | - name: Style
60 | run: styler::style_pkg()
61 | shell: Rscript {0}
62 |
63 | - name: Commit and push changes
64 | run: |
65 | if FILES_TO_COMMIT=($(git diff-index --name-only ${{ github.sha }} \
66 | | egrep --ignore-case '\.(R|[qR]md|Rmarkdown|Rnw|Rprofile)$'))
67 | then
68 | git config --local user.name "$GITHUB_ACTOR"
69 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
70 | git commit ${FILES_TO_COMMIT[*]} -m "Style code (GHA)"
71 | git pull --ff-only
72 | git push origin
73 | else
74 | echo "No changes to commit."
75 | fi
76 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | dev/
5 | inst/doc
6 | vignettes/*.html
7 | vignettes/*.R
8 | .DS_Store
9 | docs/**
10 |
--------------------------------------------------------------------------------
/.lintr:
--------------------------------------------------------------------------------
1 | linters: linters_with_defaults(
2 | line_length_linter(100),
3 | commented_code_linter = NULL
4 | )
5 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Code of Conduct
2 |
3 | As contributors and maintainers of this project, we pledge to respect all people who
4 | contribute through reporting issues, posting feature requests, updating documentation,
5 | submitting pull requests or patches, and other activities.
6 |
7 | We are committed to making participation in this project a harassment-free experience for
8 | everyone, regardless of level of experience, gender, gender identity and expression,
9 | sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
10 |
11 | Examples of unacceptable behavior by participants include the use of sexual language or
12 | imagery, derogatory comments or personal attacks, trolling, public or private harassment,
13 | insults, or other unprofessional conduct.
14 |
15 | Project maintainers have the right and responsibility to remove, edit, or reject comments,
16 | commits, code, wiki edits, issues, and other contributions that are not aligned to this
17 | Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed
18 | from the project team.
19 |
20 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
21 | opening an issue or contacting one or more of the project maintainers.
22 |
23 | This Code of Conduct is adapted from the Contributor Covenant
24 | (http:contributor-covenant.org), version 1.0.0, available at
25 | http://contributor-covenant.org/version/1/0/0/
26 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
2 | # Contributing to this project :tada: :mega:
3 |
4 | Thanks for being interested in contributing to this package :star2: :confetti_ball:
5 | and overall project! This document contains guidelines for getting started with
6 | contributing.
7 |
8 | ## Overall mission
9 |
10 | My hope from this toolkit/package is to build a R toolkit (or a series of
11 | packages) so that biomedical researchers can adhere to and use open scientific
12 | practices in as easy and as automated way as possible so that the barrier to
13 | being open and reproducible is as low as possible. Currently, the project is
14 | aimed at R users, but I would like to eventually make it more language agnostic
15 | (I know... this is an *R* package).
16 |
17 | One of the current challenges of being open is that it is hard to start doing it,
18 | since it is still so new and in constant discussion and development. There are
19 | also not a lot of resources for those in biomedical/health research for learning
20 | about it. This project hopes to start fixing those issues.
21 |
22 | ## Things to know before starting
23 |
24 | Please read over the [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating
25 | in this project you agree to abide by its terms. For other details, check out
26 | the [README](README.md).
27 |
28 | ## How and what to contribute
29 |
30 | I am looking for any and all ideas and contributions. Mostly this project needs
31 | help on the R development side, the user interface side, and for ideas on what
32 | needs to be included to simplify doing open science.
33 |
34 | ### Bugs, enhancements, or other comments
35 |
36 | Have a suggestion, idea, or comment, but don't have the time or expertise to
37 | contribute code or documentation? No worries! Head over to the
38 | [Issues](https://github.com/rostools/prodigenr/issues) page, create a new Issue,
39 | and type out those thoughts and ideas!
40 |
41 | ### Code or documentation
42 |
43 | This project adheres to the [tidyverse coding style](http://style.tidyverse.org/),
44 | so please stick to writing code in that form if you want to contribute, fix, or
45 | enhance R functions.
46 |
47 | This is a *Git* repository on *GitHub*, so there are certain procedures you will
48 | have to follow in order to contribute code or text. First and foremost is, well,
49 | you need to use Git and GitHub. GitHub has very good documentation on
50 | [using Git with GitHub](https://guides.github.com/activities/hello-world/). If
51 | you are a beginner to Git, there is an excellent [interactive tutorial](https://try.github.io/levels/1/challenges/1)
52 | you can use to learn Git.
53 |
54 | Some specifics about contributing:
55 |
56 | - You'll need to [fork the repository](https://help.github.com/articles/fork-a-repo/)
57 | before you can contribute.
58 | - Git messages should be clear and concisely describe the change made in the commit.
59 | - Each commit should be fairly small and/or focused. Don't commit all changes in
60 | one commit, but rather break it up into smaller commits.
61 | - The [Pull Request](https://help.github.com/articles/about-pull-requests/) should
62 | describe the change fairly concisely, preferably referencing an existing problem or
63 | feature request from the [Issues](https://github.com/rostools/prodigenr/issues)
64 | (but it doesn't have to be).
65 |
66 | I'll try to label issues that would be good first attempts for new contributors
67 | with a `easy` label. I also label issues with `hard` if the task is a bit more
68 | difficult and `low priority` or `high priority` for issues to focus more on.
69 |
70 | No matter how you contribute, your help and thoughts and ideas are truly appreciated!!
71 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: prodigenr
2 | Title: Research Project Directory Generator
3 | Version: 0.7.0.9000
4 | Authors@R:
5 | person("Luke", "Johnston", , "lwjohnst@gmail.com", role = c("aut", "cre"),
6 | comment = c(ORCID = "0000-0003-4169-2616"))
7 | Description: Create a project directory structure, along with typical
8 | files for that project. This allows projects to be quickly and easily
9 | created, as well as for them to be standardized. Designed specifically
10 | with scientists in mind (mainly bio-medical researchers, but likely
11 | applies to other fields).
12 | License: MIT + file LICENSE
13 | URL: https://github.com/rostools/prodigenr,
14 | https://rostools.github.io/prodigenr/
15 | BugReports: https://github.com/rostools/prodigenr/issues
16 | Depends:
17 | R (>= 4.0.0)
18 | Imports:
19 | cli,
20 | fs,
21 | gert,
22 | rlang,
23 | rprojroot,
24 | whisker,
25 | withr
26 | Suggests:
27 | knitr,
28 | rmarkdown,
29 | testthat
30 | VignetteBuilder:
31 | knitr
32 | Encoding: UTF-8
33 | Language: en-US
34 | Roxygen: list(markdown = TRUE)
35 | RoxygenNote: 7.3.2
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | YEAR: 2015-2024
2 | COPYRIGHT HOLDER: Luke W. Johnston
3 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # MIT License
2 |
3 | Copyright (c) 2019 Luke W. Johnston
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | export(create_report)
4 | export(create_slides)
5 | export(setup_project)
6 | export(setup_with_git)
7 | export(template_list)
8 |
--------------------------------------------------------------------------------
/NEWS.md:
--------------------------------------------------------------------------------
1 | # prodigenr (development version)
2 |
3 | # prodigenr 0.7.0
4 |
5 | ## Breaking changes
6 |
7 | - New projects have Git added from the beginning, so don't need to use
8 | `setup_with_git()` (#148).
9 | - `rmarkdown::draft()` can't have Quarto docs in the `template/`
10 | folders, so instead move them as generic Quarto template files.
11 | - Rename `doc/` to `docs/` in the basic analysis project folder. This
12 | is to match the semantics that the `docs/` folder usually will have
13 | more than one document in it (#149).
14 | - It isn't always useful to have the report created when the project
15 | is setup, so adding the report via `create_report()` is removed from
16 | `project_setup()` (#142).
17 | - Use Quarto instead of R Markdown for template files (#150).
18 |
19 | ## Features and additions
20 |
21 | - When creating a new `.gitignore`, include `.quarto` and `.DS_Store`
22 | files (#141) as well as `.Rbuildignore` files (#143).
23 | - New projects have `.Rproj` set with same options as
24 | `usethis::use_blank_slate("project")` (#144).
25 | - Move `gert` to imports, since it makes more sense that it should be
26 | a hard dependency as the project is an opinionated project creator
27 | (#145).
28 |
29 | ## Fixes and improvements
30 |
31 | - The `title` field in the `DESCRIPTION` file is needed by many
32 | usethis functions, so it is added to the created `DESCRIPTION` file
33 | (#137).
34 |
35 | # prodigenr 0.6.2
36 |
37 | ## Minor changes and CRAN fixes
38 |
39 | - Removed Distill from imports and from created report, switching to
40 | using Quarto instead (e.g. with YAML metadata).
41 | - Removed AppVeyor.
42 | - Rearranged project creation to copy an internal folder (with
43 | necessary files) into the specified folder on the users computer.
44 | This hopefully will make it easier to add other templates later on.
45 | - Updated package aims to be clearer and more focused.
46 | - Fixes to CRAN notes about HTML5.
47 |
48 | # prodigenr 0.6.1
49 |
50 | ## Bug fix
51 |
52 | - DESCRIPTION file actually needs a `Package` field (#127).
53 |
54 | # prodigenr 0.6.0
55 |
56 | ## Major changes
57 |
58 | - Removed abstract and poster templates. Abstracts are so small it
59 | isn't an important addition and (I sense) posters will for a while
60 | be created with other software tools (e.g. PowerPoint). Plus there
61 | aren't many mature and well-established poster packages in R at this
62 | point in time.
63 | - Tidied up and trim down all the README files and include pointers to
64 | the prodigenr online documentation instead.
65 | - Removed R script template files. Projects might be too diverse for
66 | these template scripts to make sense.
67 | - Removed several dependencies, including the usethis package.
68 | - Moved Git initialization setup out into new function called
69 | `setup_with_git()`.
70 |
71 | # prodigenr 0.5.0
72 |
73 | ## Major change
74 |
75 | - Switch to having only one argument for `setup_project()` called
76 | `path` (#102)
77 |
78 | ## Additions
79 |
80 | - Can now use RStudio's "New Project" interface for a GUI creation of
81 | the project (#109, #111)
82 | - Setup projects to be "blank slates" (i.e. don't save `.RData`)
83 | (#105)
84 | - Add TODO list to project to complete after project creation (#39)
85 |
86 | ## Hotfix
87 |
88 | - Fix NOTES in CRAN results check for unused dependencies (clipr,
89 | desc, devtools)
90 |
91 | ## Misc
92 |
93 | - Remove deprecated `prodigen()` function (#107)
94 | - Replace current interactive messaging with `usethis::ui_*` functions
95 | - Reduced opinionated content and moved over to
96 | [rostools](https://github.com/rostools/rostools) and its
97 | [manifesto](https://gitlab.com/rostools/manifesto) (#108)
98 | - Removed some dependencies by using functions from usethis
99 | - Incorporate `use_template()` instead of custom function (#101)
100 |
101 | # prodigenr 0.4.0
102 |
103 | ## New feature
104 |
105 | - Use R Markdown template files to draft the posters, slides,
106 | manuscripts, and abstract (#70, #75). See `create_*` type commands.
107 | - New function to setup a general project, but excluding the
108 | individual document types such manuscript, slides, etc (#72).
109 | `prodigen` function is deprecated.
110 | - READMEs in each folder and section to fill out in main README for
111 | the project description (#38, #80).
112 |
113 | ## Removals
114 |
115 | - Moved `include_*()` functions over into
116 | [rostools](https://github.com/rostools/rostools) (#96)
117 |
118 | ## Minor fixes
119 |
120 | - Added additional information to template `README.md` (#29, #30, #32)
121 |
122 | ## Misc additions
123 |
124 | - TODO items to created README
125 | - Added code coverage #65
126 |
127 | # prodigenr 0.3.0
128 |
129 | ## New features/functionality
130 |
131 | - `prodigen()` now creates a new project structure that mimics R
132 | package development more, specifically `devtools` (since it is well
133 | documented and actively maintained) (#18, #15, #14). The old style
134 | has been removed.
135 | - Added a function to include a
136 | [STROBE](https://www.strobe-statement.org/) checklist for reporting
137 | guidelines (#21).
138 | - Added function to include an `rfigshare` script to send to
139 | [figshare](https://figshare.com/) (#19).
140 | - Added function to include a more complete MIT license (#20).
141 |
142 | # prodigenr 0.2.7
143 |
144 | - Added a `NEWS.md` file to track changes to the package.
145 | - Fixed a bug that prevented an `.Rproj` file and the `.Rprofile`
146 | files from being installed and created.
147 |
--------------------------------------------------------------------------------
/R/create_doc.R:
--------------------------------------------------------------------------------
1 | #' Create a basic Quarto document from a template.
2 | #'
3 | #' Creates manuscript/report or slide Quarto file and saves it into
4 | #' the `docs/` folder.
5 | #'
6 | #' @param type The file type (e.g. report, slides).
7 | #'
8 | #' @return A created `.qmd` file in the `docs/` folder.
9 | #'
10 | #' @examples
11 | #' \dontrun{
12 | #' create_report()
13 | #' create_slides()
14 | #' }
15 | create_doc <- function(type = c("report", "slides")) {
16 | if (!is_rproj_folder()) {
17 | cli::cli_abort(c(
18 | "The folder does not contain an {.val .Rproj} file.",
19 | "i" = "Use while in a project made with {.fn prodigenr::setup_project}."
20 | ))
21 | }
22 |
23 | if (!dir.exists("docs")) {
24 | cli::cli_abort("We can't find a {.path docs/} folder, but need it.")
25 | }
26 |
27 | type <- rlang::arg_match(type)
28 | type <- fs::path_ext_set(type, "qmd")
29 | file_name <- normalizePath(file.path("docs", paste0(type)), mustWork = FALSE)
30 | template_file <- fs::path_package("prodigenr", "templates", "documents", type)
31 | if (fs::file_exists(file_name)) {
32 | cli::cli_abort("The file {.file docs/{type}} already exists.")
33 | } else {
34 | fs::file_copy(
35 | path = template_file,
36 | new_path = file_name
37 | )
38 | cli::cli_alert_success("Created the {.file docs/{type}}!")
39 | }
40 | invisible()
41 | }
42 |
43 | #' @describeIn create_doc Creates a report Quarto document in the `docs/` folder.
44 | #' @export
45 | create_report <- function() {
46 | create_doc(type = "report")
47 | return(invisible())
48 | }
49 |
50 | #' @describeIn create_doc Creates a Quarto document for making slides in the `docs/` folder.
51 | #' @export
52 | create_slides <- function() {
53 | create_doc(type = "slides")
54 | }
55 |
56 | #' List project templates within \pkg{prodigenr}.
57 | #'
58 | #' Get a list of available templates in a package.
59 | #'
60 | #' @return Vector of templates available
61 | #' @export
62 | #' @examples
63 | #' template_list
64 | #'
65 | template_list <- c("report", "slides")
66 |
--------------------------------------------------------------------------------
/R/prodigenr-package.R:
--------------------------------------------------------------------------------
1 | #' @keywords internal
2 | "_PACKAGE"
3 |
4 | # The following block is used by usethis to automatically manage
5 | # roxygen namespace tags. Modify with care!
6 | ## usethis namespace: start
7 | ## usethis namespace: end
8 | NULL
9 |
--------------------------------------------------------------------------------
/R/rstudio_setup.R:
--------------------------------------------------------------------------------
1 | rstudio_setup <- function(path, ...) {
2 | # create project
3 | setup_project(path = path)
4 | invisible(NULL)
5 | }
6 |
--------------------------------------------------------------------------------
/R/setup_project.R:
--------------------------------------------------------------------------------
1 | #' Setup a standardized folder and file structure for a research analysis project.
2 | #'
3 | #' This starts the project by setting up a common folder and file infrastructure,
4 | #' as well as adding some useful files to start the project. Also adds Git to the
5 | #' project.
6 | #'
7 | #' @param path A path to a new directory.
8 | #'
9 | #' @return Project setup with folders and files necessary for a standard research project.
10 | #' @export
11 | #'
12 | #' @examples
13 | #' \dontrun{
14 | #' # Use a temporary location
15 | #' new_proj_name <- fs::path_temp("DiabetesCancer")
16 | #' setup_project(new_proj_name)
17 | #' # After the new project opens up, add Git with:
18 | #' setup_with_git()
19 | #' }
20 | setup_project <-
21 | function(path) {
22 | stopifnot(is.character(path))
23 | proj_path <- fs::path_abs(path)
24 | proj_name <- fs::path_file(proj_path)
25 |
26 | if (grepl(" ", basename(proj_path))) {
27 | rlang::warn("Project name has a space in it, replacing with a dash (-).")
28 | proj_path <- path_remove_spaces(proj_path)
29 | }
30 |
31 | if (fs::dir_exists(proj_path)) {
32 | if (has_only_git(proj_path)) {
33 | cli::cli_alert_info("The project already has Git added, so we will skip setting up Git.")
34 | } else {
35 | cli::cli_abort(c(
36 | "The {.val {proj_path}} folder already exists, so project creation is canceled.",
37 | "i" = "Delete the folder or use another name (not {.val {proj_name}}) for your project."
38 | ))
39 | }
40 | }
41 | proj_template <- find_template("projects", "basic-analysis")
42 | fs::dir_copy(proj_template, new_path = proj_path, overwrite = TRUE)
43 |
44 | withr::with_dir(
45 | new = proj_path,
46 | code = {
47 | update_template("DESCRIPTION", data = list(ProjectName = proj_name))
48 | update_template("template-Rproj", paste0(proj_name, ".Rproj"))
49 | fs::file_delete("template-Rproj")
50 | fs::file_move("gitignore", ".gitignore")
51 | update_template("README.md", data = list(ProjectName = proj_name))
52 | if (!fs::dir_exists(".git")) {
53 | gert::git_init()
54 | }
55 | }
56 | )
57 | }
58 |
59 | has_only_git <- function(path) {
60 | all(basename(fs::dir_ls(path, all = TRUE)) == ".git")
61 | }
62 |
63 | # Git setup functions -------------------------------------------
64 |
65 | #' Setup Git to the project.
66 | #'
67 | #' Takes a lot of inspiration from the usethis `use_git()` function, except
68 | #' it only adds Git and nothing more (doesn't commit, doesn't restart RStudio
69 | #' automatically). Must run this function inside the project you created from
70 | #' [setup_project()].
71 | #'
72 | #' @return Adds Git and `.gitignore` file to the project.
73 | #' @export
74 | #' @seealso [setup_project()] for starting the project.
75 | #'
76 | setup_with_git <- function() {
77 | if (!is_rproj_folder()) {
78 | cli::cli_abort(c("The folder does not contain an {.val .Rproj} file.",
79 | "i" = "Use while in the project made with {.code prodigenr::setup_project().}"
80 | ))
81 | }
82 |
83 | if (has_git()) {
84 | rlang::abort("The project already has Git added.")
85 | }
86 |
87 | gert::git_init()
88 | set_git_ignore_files()
89 | cli::cli_alert_info("You might need to restart RStudio to see the Git pane.")
90 | return(invisible(NULL))
91 | }
92 |
93 | # Utilities -----------------------------------------------------
94 |
95 | set_git_ignore_files <- function() {
96 | base::writeLines(
97 | c(".Rhistory", ".RData", ".Rproj.user", ".Rbuildignore", ".DS_Store", ".quarto"),
98 | ".gitignore"
99 | )
100 | }
101 |
102 | path_remove_spaces <- function(path) {
103 | path_as_vector <- fs::path_split(path)[[1]]
104 | last_dir <- length(path_as_vector)
105 | path_as_vector[last_dir] <- gsub(" +", "-", path_as_vector[last_dir])
106 | fs::path_join(path_as_vector)
107 | }
108 |
--------------------------------------------------------------------------------
/R/usethis-utils.R:
--------------------------------------------------------------------------------
1 | # Code in this file was taken and modified from the usethis package.
2 | # Below is the license statement from usethis.
3 | #
4 | # # MIT License
5 | #
6 | # Copyright (c) 2020 usethis authors
7 | #
8 | # Permission is hereby granted, free of charge, to any person obtaining a copy
9 | # of this software and associated documentation files (the "Software"), to deal
10 | # in the Software without restriction, including without limitation the rights
11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | # copies of the Software, and to permit persons to whom the Software is
13 | # furnished to do so, subject to the following conditions:
14 | #
15 | # The above copyright notice and this permission notice shall be included in all
16 | # copies or substantial portions of the Software.
17 | #
18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | # SOFTWARE.
25 |
26 | # Taken from usethis package and slightly modified
27 | update_template <- function(template,
28 | save_as = template,
29 | data = list()) {
30 | template_contents <-
31 | base::strsplit(whisker::whisker.render(
32 | read_utf8(template),
33 | data
34 | ), "\n")[[1]]
35 | new <- base::writeLines(template_contents, save_as)
36 | invisible(new)
37 | }
38 |
39 | # Taken from usethis package and modified to this package.
40 | find_template <- function(...) {
41 | fs::path_package(package = "prodigenr", "templates", ...)
42 | }
43 |
44 | # Taken from usethis package
45 | read_utf8 <- function(path, n = -1L) {
46 | base::readLines(path, n = n, encoding = "UTF-8", warn = FALSE)
47 | }
48 |
49 | # Taken from usethis:::uses_git
50 | has_git <- function(project_path = ".") {
51 | repo <- tryCatch(gert::git_find(project_path), error = function(e) NULL)
52 | !is.null(repo)
53 | }
54 |
--------------------------------------------------------------------------------
/R/utils.R:
--------------------------------------------------------------------------------
1 | is_rproj_folder <- function() {
2 | rprojroot::is.root_criterion(rprojroot::is_rstudio_project)
3 | }
4 |
5 | viz_project_tree <- function(path) {
6 | withr::with_dir(fs::path_dir(path), {
7 | fs::dir_tree(basename(path), all = TRUE)
8 | })
9 | }
10 |
--------------------------------------------------------------------------------
/README.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output: github_document
3 | ---
4 |
5 |
6 |
7 | ```{r, include = FALSE}
8 | knitr::opts_chunk$set(
9 | collapse = TRUE,
10 | comment = "#>",
11 | fig.path = "man/figures/README-",
12 | out.width = "100%"
13 | )
14 | ```
15 |
16 | # Create projects with prodigenr
17 |
18 |
19 |
20 | [](https://cran.r-project.org/package=prodigenr)
22 | [](https://github.com/rostools/prodigenr/actions)
23 | [](https://lifecycle.r-lib.org/articles/stages.html)
24 | [](https://www.r-pkg.org:443/pkg/prodigenr)
26 |
27 |
28 |
29 | This package has a simple aim of being a project directory generator
30 | (prodigenr), with a simple focus on:
31 |
32 | 1. Creating a standardized project folder structure with a few template
33 | files needed for beginning a data analysis project.
34 | 2. Following a "one project, one (main) output" principle, such as a
35 | report/manuscript in the case of scientific output or a book or
36 | website for things like courses or workshops.
37 | 3. Adhering to established best practices that make it easier for the
38 | project to be reproducible and open.
39 |
40 | This standardized approach to how a scientific project is structured
41 | helps ensure that the final code and documents are fairly modular,
42 | self-contained, easy to share and make public, and be as reproducible as
43 | possible. The structure also makes use of the existing and established
44 | applications and workflows ([RStudio](https://posit.co/),
45 | [devtools](https://CRAN.R-project.org/package=devtools), and
46 | [usethis](https://CRAN.R-project.org/package=usethis)).
47 |
48 | ## Installation
49 |
50 | You can install the released version of prodigenr from
51 | [CRAN](https://cran.r-project.org) with:
52 |
53 | ``` r
54 | install.packages("prodigenr")
55 | ```
56 |
57 | And the development version from [GitHub](https://github.com/) with:
58 |
59 | ``` r
60 | # install.packages("pak")
61 | pak::pak("rostools/prodigenr")
62 | ```
63 |
64 | ## Usage
65 |
66 | There are two ways of creating a new project: using the R console or
67 | using the RStudio "New Project" menu option.
68 |
69 | Through the console, use the `setup_project()` command. So, for
70 | instance, if you want a manuscript project, type out:
71 |
72 | ``` r
73 | library(prodigenr)
74 | setup_project("~/Desktop/DiseaseDiet")
75 | ```
76 |
77 | This then creates a directory tree, with template files for starting
78 | your analysis! Open the newly created project via the `.Rproj` file. For
79 | the RStudio approach, go to "File -\> New Project", then "New directory"
80 | and find the prodigenr project in the list.
81 |
82 | Once in the project, you can add a manuscript/report
83 | [Quarto](https://quarto.org/) file using:
84 |
85 | ``` r
86 | create_report()
87 | ```
88 |
89 | The main secondary function is the `template_list` command, which lists
90 | the available template files:
91 |
92 | ```{r, include=FALSE}
93 | library(prodigenr)
94 | ```
95 |
96 | ```{r}
97 | template_list
98 | ```
99 |
100 | For a more detailed tutorial, see the introduction vignette:
101 |
102 | ``` r
103 | vignette('prodigenr', 'prodigenr')
104 | ```
105 |
106 | ## Related packages or projects
107 |
108 | There are several existing packages for creating projects, each of which
109 | has it's own pros and cons. Check out the last section of the
110 | `vignette("prodigenr")` for more details. Try them out and see which you
111 | like!
112 |
113 | prodigenr tries to use ideas from R
114 | packages/[devtools](https://CRAN.R-project.org/package=devtools) while
115 | still being as simple as possible and to be more specific to academic
116 | researchers primarily in biomedical/non-computer science fields.
117 | However, it can always improve! I welcome any suggestions, just submit a
118 | [GitHub issue](https://github.com/rostools/prodigenr/issues).
119 |
120 | ## Interested in contributing?
121 |
122 | See the [contributing
123 | documentation](https://rostools.github.io/prodigenr/CONTRIBUTING.html)
124 | for information on how to contribute. Please note that this project is
125 | released with a [Contributor Code of
126 | Conduct](https://rostools.github.io/prodigenr/CODE_OF_CONDUCT.html). By
127 | participating in this project you agree to abide by its terms.
128 |
129 | Special thanks to Zhila Semnani for creating the logo!
130 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # Create projects with prodigenr
5 |
6 |
7 |
8 | [](https://cran.r-project.org/package=prodigenr)
10 | [](https://github.com/rostools/prodigenr/actions)
11 | [](https://lifecycle.r-lib.org/articles/stages.html)
12 | [](https://www.r-pkg.org:443/pkg/prodigenr)
14 |
15 |
16 |
17 | This package has a simple aim of being a project directory generator
18 | (prodigenr), with a simple focus on:
19 |
20 | 1. Creating a standardized project folder structure with a few template
21 | files needed for beginning a data analysis project.
22 | 2. Following a “one project, one (main) output” principle, such as a
23 | report/manuscript in the case of scientific output or a book or
24 | website for things like courses or workshops.
25 | 3. Adhering to established best practices that make it easier for the
26 | project to be reproducible and open.
27 |
28 | This standardized approach to how a scientific project is structured
29 | helps ensure that the final code and documents are fairly modular,
30 | self-contained, easy to share and make public, and be as reproducible as
31 | possible. The structure also makes use of the existing and established
32 | applications and workflows ([RStudio](https://posit.co/),
33 | [devtools](https://CRAN.R-project.org/package=devtools), and
34 | [usethis](https://CRAN.R-project.org/package=usethis)).
35 |
36 | ## Installation
37 |
38 | You can install the released version of prodigenr from
39 | [CRAN](https://cran.r-project.org) with:
40 |
41 | ``` r
42 | install.packages("prodigenr")
43 | ```
44 |
45 | And the development version from [GitHub](https://github.com/) with:
46 |
47 | ``` r
48 | # install.packages("pak")
49 | pak::pak("rostools/prodigenr")
50 | ```
51 |
52 | ## Usage
53 |
54 | There are two ways of creating a new project: using the R console or
55 | using the RStudio “New Project” menu option.
56 |
57 | Through the console, use the `setup_project()` command. So, for
58 | instance, if you want a manuscript project, type out:
59 |
60 | ``` r
61 | library(prodigenr)
62 | setup_project("~/Desktop/DiseaseDiet")
63 | ```
64 |
65 | This then creates a directory tree, with template files for starting
66 | your analysis! Open the newly created project via the `.Rproj` file. For
67 | the RStudio approach, go to “File -\> New Project”, then “New directory”
68 | and find the prodigenr project in the list.
69 |
70 | Once in the project, you can add a manuscript/report
71 | [Quarto](https://quarto.org/) file using:
72 |
73 | ``` r
74 | create_report()
75 | ```
76 |
77 | The main secondary function is the `template_list` command, which lists
78 | the available template files:
79 |
80 | ``` r
81 | template_list
82 | #> [1] "report" "slides"
83 | ```
84 |
85 | For a more detailed tutorial, see the introduction vignette:
86 |
87 | ``` r
88 | vignette('prodigenr', 'prodigenr')
89 | ```
90 |
91 | ## Related packages or projects
92 |
93 | There are several existing packages for creating projects, each of which
94 | has it’s own pros and cons. Check out the last section of the
95 | `vignette("prodigenr")` for more details. Try them out and see which you
96 | like!
97 |
98 | prodigenr tries to use ideas from R
99 | packages/[devtools](https://CRAN.R-project.org/package=devtools) while
100 | still being as simple as possible and to be more specific to academic
101 | researchers primarily in biomedical/non-computer science fields.
102 | However, it can always improve! I welcome any suggestions, just submit a
103 | [GitHub issue](https://github.com/rostools/prodigenr/issues).
104 |
105 | ## Interested in contributing?
106 |
107 | See the [contributing
108 | documentation](https://rostools.github.io/prodigenr/CONTRIBUTING.html)
109 | for information on how to contribute. Please note that this project is
110 | released with a [Contributor Code of
111 | Conduct](https://rostools.github.io/prodigenr/CODE_OF_CONDUCT.html). By
112 | participating in this project you agree to abide by its terms.
113 |
114 | Special thanks to Zhila Semnani for creating the logo!
115 |
--------------------------------------------------------------------------------
/_pkgdown.yml:
--------------------------------------------------------------------------------
1 | url: https://rostools.github.io/prodigenr/
2 | template:
3 | bootstrap: 5
4 |
5 |
--------------------------------------------------------------------------------
/cran-comments.md:
--------------------------------------------------------------------------------
1 | ## Test environments
2 |
3 | - Ubunto 24.04 (local), R 4.4.1
4 | - winbuilder
5 | - MacOS, Windows, Ubuntu (on GitHub Actions), r-release
6 |
7 | ## R CMD check results
8 |
9 | 0 errors ✔ \| 0 warnings ✔ \| 0 notes ✔
10 |
11 | ## Reverse dependencies
12 |
13 | There are no reverse dependencies.
14 |
--------------------------------------------------------------------------------
/inst/WORDLIST:
--------------------------------------------------------------------------------
1 | AppVeyor
2 | CMD
3 | Hotfix
4 | ORCID
5 | README
6 | READMEs
7 | RStudio
8 | RStudio's
9 | Semnani
10 | YAML
11 | Zhila
12 | clipr
13 | desc
14 | devtools
15 | figshare
16 | lifecycle
17 | rOpenSci
18 | rostools
19 | usethis
20 |
--------------------------------------------------------------------------------
/inst/rstudio/templates/project/rstudio_setup.dcf:
--------------------------------------------------------------------------------
1 | Binding: rstudio_setup
2 | Title: Scientific Analysis Project using prodigenr
3 | OpenFiles: README.md
4 |
5 |
--------------------------------------------------------------------------------
/inst/templates/documents/report.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | # Uses Quarto metadata: https://quarto.org/docs/journals/authors.html
3 | title: ""
4 | author:
5 | - name: ""
6 | orcid: ""
7 | affiliations:
8 | - name: ""
9 | date: last-modified
10 | format: html
11 | execute:
12 | echo: false
13 | ---
14 |
15 | ```{r setup}
16 | #| include: false
17 | ```
18 |
19 | # Abstract
20 |
21 | Objective:
22 |
23 | Research Design and Methods:
24 |
25 | Results:
26 |
27 | Conclusions:
28 |
29 | # Introduction
30 |
31 | # Research Design and Methods
32 |
33 | # Results
34 |
35 | # Conclusions
36 |
37 | # Acknowledgements
38 |
39 | # References
40 |
41 | # Tables
42 |
43 | # Figures
44 |
45 | # Supplemental Material
46 |
--------------------------------------------------------------------------------
/inst/templates/documents/slides.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: ""
3 | date: last-modified
4 | date-format: long
5 | author: ""
6 | format: revealjs
7 | ---
8 |
9 |
10 |
--------------------------------------------------------------------------------
/inst/templates/projects/basic-analysis/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: {{ProjectName}}
2 | Title: Analysis Project for {{ProjectName}}
3 | Type: Project
4 | Version: 0.0.1
5 | Encoding: UTF-8
6 |
--------------------------------------------------------------------------------
/inst/templates/projects/basic-analysis/R/README.md:
--------------------------------------------------------------------------------
1 | # Description of R/ folder and .R files
2 |
3 | This folder contains custom functions or R scripts used for this
4 | project's analyses, such as in the `docs/` folder. Each R script is
5 | split up into sections (e.g. with RStudio's 'Insert Section' with
6 | Ctrl-Shift-R) by utility or purpose. You can use the 'Document Outline'
7 | (Ctrl-Shift-O) to see the sections and functions.
8 |
--------------------------------------------------------------------------------
/inst/templates/projects/basic-analysis/README.md:
--------------------------------------------------------------------------------
1 | TODO: Add more to the title of your project here
2 |
3 | # {{ ProjectName }}:
4 |
5 | TODO: Give a brief description of what your project is about
6 |
7 | This project...
8 |
9 | # Brief description of folder and file contents
10 |
11 | TODO: As project evolves, add brief description of what is inside the
12 | data, docs and R folders.
13 |
14 | The following folders contain:
15 |
16 | - `data/`:
17 | - `docs/`:
18 | - `R/`:
19 |
20 | # Installing project R package dependencies
21 |
22 | If dependencies have been managed by using
23 | `usethis::use_package("packagename")` through the `DESCRIPTION` file,
24 | installing dependencies is as easy as opening the
25 | `{{ProjectName}}.Rproj` file and running this command in the console:
26 |
27 | ```
28 | # install.packages("pak")
29 | pak::pak()
30 | ```
31 |
32 | You'll need to have remotes installed for this to work.
33 |
34 | # Resource
35 |
36 | For more information on this folder and file workflow and setup, check
37 | out the [prodigenr](https://rostools.github.io/prodigenr) online
38 | documentation.
39 |
--------------------------------------------------------------------------------
/inst/templates/projects/basic-analysis/TODO.md:
--------------------------------------------------------------------------------
1 | Some TODO items after creating this project. Can delete this file after
2 | completing them.
3 |
4 | - TODO: Fill in project details in `README.md`
5 | - TODO: Read through the data, docs, and R README files and edit as
6 | necessary
7 | - TODO: Add and commit all files under Git version control
8 |
--------------------------------------------------------------------------------
/inst/templates/projects/basic-analysis/data-raw/README.md:
--------------------------------------------------------------------------------
1 | # Contents of data folder
2 |
3 | Should contain the *raw* (unedited) data used specifically for the
4 | scientific project and product (e.g. the manuscript).
5 |
6 | While ideally the original raw data used for the project should be
7 | stored here, this isn't always possible. At the minimum, include
8 | instructions on how to access the raw data or where it came from.
9 |
--------------------------------------------------------------------------------
/inst/templates/projects/basic-analysis/data/README.md:
--------------------------------------------------------------------------------
1 | # Contents of data folder
2 |
3 | Should contain the data used specifically for the scientific project
4 | and product (e.g. the manuscript).
5 |
6 | Ideally the cleaned and processed data used for the project should be
7 | included here, however, this isn't always possible. At the least, a
8 | simulated or fake dataset of the original should be included to ensure
9 | that the code used in this project runs as intended.
10 |
11 | Results generated from any analyses that are part of the project
12 | should also be stored here as data files. Saving the results here
13 | has the advantage that you don't have to always re-run analyses and
14 | that they can be inspected by reviewers or other researchers to
15 | verify the findings.
16 |
--------------------------------------------------------------------------------
/inst/templates/projects/basic-analysis/docs/README.md:
--------------------------------------------------------------------------------
1 | # Contents of docs folder
2 |
3 | This folder should contain the main scientific product of the project as
4 | well as all other files related to it (e.g. co-author comments,
5 | versions, images, etc). It may and likely should also contain
6 | supplementary and exploratory R Markdown files. Once submission or
7 | presentation time has come for the product, files associated with that
8 | process (e.g. response to reviewers) should be placed in here.
9 |
--------------------------------------------------------------------------------
/inst/templates/projects/basic-analysis/gitignore:
--------------------------------------------------------------------------------
1 | # R and RStudio files to ignore
2 | .Rhistory
3 | .RData
4 | .Rproj.user
5 | .Rbuildignore
6 | # MacOS file to ignore
7 | .DS_Store
8 | # Quarto folder to ignore
9 | .quarto
10 |
--------------------------------------------------------------------------------
/inst/templates/projects/basic-analysis/template-Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: No
4 | SaveWorkspace: No
5 | AlwaysSaveHistory: No
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: knitr
13 | LaTeX: pdfLaTeX
14 |
15 | AutoAppendNewline: Yes
16 | StripTrailingWhitespace: Yes
17 |
18 |
--------------------------------------------------------------------------------
/justfile:
--------------------------------------------------------------------------------
1 | @_default:
2 | just --list --unsorted
3 |
4 | # Run all recipes
5 | run-all: install-package-dependencies document spell-check style lint test build-site check install-package
6 |
7 | # Install package dependencies
8 | install-package-dependencies:
9 | #!/usr/bin/Rscript
10 | pak::pak(ask = FALSE)
11 |
12 | # Run document generators
13 | document:
14 | #!/usr/bin/Rscript
15 | devtools::document()
16 |
17 | # Run tests
18 | test:
19 | #!/usr/bin/Rscript
20 | devtools::test()
21 |
22 | # Check spelling
23 | spell-check:
24 | #!/usr/bin/Rscript
25 | devtools::spell_check()
26 |
27 | # Check URLs
28 | url-check:
29 | #!/usr/bin/Rscript
30 | urlchecker::url_check()
31 |
32 | # Style all R code
33 | style:
34 | #!/usr/bin/Rscript
35 | styler::style_pkg()
36 |
37 | # Run linter
38 | lint:
39 | #!/usr/bin/Rscript
40 | devtools::lint()
41 |
42 | # Build pkgdown website
43 | build-site:
44 | #!/usr/bin/Rscript
45 | pkgdown::build_site()
46 |
47 | # Run local CRAN checks
48 | check:
49 | #!/usr/bin/Rscript
50 | devtools::check()
51 |
52 | # Install prodigenr as a package
53 | install-package: install-package-dependencies
54 | #!/usr/bin/Rscript
55 | devtools::install()
56 |
--------------------------------------------------------------------------------
/man/create_doc.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/create_doc.R
3 | \name{create_doc}
4 | \alias{create_doc}
5 | \alias{create_report}
6 | \alias{create_slides}
7 | \title{Create a basic Quarto document from a template.}
8 | \usage{
9 | create_doc(type = c("report", "slides"))
10 |
11 | create_report()
12 |
13 | create_slides()
14 | }
15 | \arguments{
16 | \item{type}{The file type (e.g. report, slides).}
17 | }
18 | \value{
19 | A created \code{.qmd} file in the \verb{docs/} folder.
20 | }
21 | \description{
22 | Creates manuscript/report or slide Quarto file and saves it into
23 | the \verb{docs/} folder.
24 | }
25 | \section{Functions}{
26 | \itemize{
27 | \item \code{create_report()}: Creates a report Quarto document in the \verb{docs/} folder.
28 |
29 | \item \code{create_slides()}: Creates a Quarto document for making slides in the \verb{docs/} folder.
30 |
31 | }}
32 | \examples{
33 | \dontrun{
34 | create_report()
35 | create_slides()
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/man/figures/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rostools/prodigenr/6d32c84fc3c1faf516e998794a1f00b498597c15/man/figures/logo.png
--------------------------------------------------------------------------------
/man/prodigenr-package.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/prodigenr-package.R
3 | \docType{package}
4 | \name{prodigenr-package}
5 | \alias{prodigenr}
6 | \alias{prodigenr-package}
7 | \title{prodigenr: Research Project Directory Generator}
8 | \description{
9 | \if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}}
10 |
11 | Create a project directory structure, along with typical files for that project. This allows projects to be quickly and easily created, as well as for them to be standardized. Designed specifically with scientists in mind (mainly bio-medical researchers, but likely applies to other fields).
12 | }
13 | \seealso{
14 | Useful links:
15 | \itemize{
16 | \item \url{https://github.com/rostools/prodigenr}
17 | \item \url{https://rostools.github.io/prodigenr/}
18 | \item Report bugs at \url{https://github.com/rostools/prodigenr/issues}
19 | }
20 |
21 | }
22 | \author{
23 | \strong{Maintainer}: Luke Johnston \email{lwjohnst@gmail.com} (\href{https://orcid.org/0000-0003-4169-2616}{ORCID})
24 |
25 | }
26 | \keyword{internal}
27 |
--------------------------------------------------------------------------------
/man/setup_project.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/setup_project.R
3 | \name{setup_project}
4 | \alias{setup_project}
5 | \title{Setup a standardized folder and file structure for a research analysis project.}
6 | \usage{
7 | setup_project(path)
8 | }
9 | \arguments{
10 | \item{path}{A path to a new directory.}
11 | }
12 | \value{
13 | Project setup with folders and files necessary for a standard research project.
14 | }
15 | \description{
16 | This starts the project by setting up a common folder and file infrastructure,
17 | as well as adding some useful files to start the project. Also adds Git to the
18 | project.
19 | }
20 | \examples{
21 | \dontrun{
22 | # Use a temporary location
23 | new_proj_name <- fs::path_temp("DiabetesCancer")
24 | setup_project(new_proj_name)
25 | # After the new project opens up, add Git with:
26 | setup_with_git()
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/man/setup_with_git.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/setup_project.R
3 | \name{setup_with_git}
4 | \alias{setup_with_git}
5 | \title{Setup Git to the project.}
6 | \usage{
7 | setup_with_git()
8 | }
9 | \value{
10 | Adds Git and \code{.gitignore} file to the project.
11 | }
12 | \description{
13 | Takes a lot of inspiration from the usethis \code{use_git()} function, except
14 | it only adds Git and nothing more (doesn't commit, doesn't restart RStudio
15 | automatically). Must run this function inside the project you created from
16 | \code{\link[=setup_project]{setup_project()}}.
17 | }
18 | \seealso{
19 | \code{\link[=setup_project]{setup_project()}} for starting the project.
20 | }
21 |
--------------------------------------------------------------------------------
/man/template_list.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/create_doc.R
3 | \docType{data}
4 | \name{template_list}
5 | \alias{template_list}
6 | \title{List project templates within \pkg{prodigenr}.}
7 | \format{
8 | An object of class \code{character} of length 2.
9 | }
10 | \usage{
11 | template_list
12 | }
13 | \value{
14 | Vector of templates available
15 | }
16 | \description{
17 | Get a list of available templates in a package.
18 | }
19 | \examples{
20 | template_list
21 |
22 | }
23 | \keyword{datasets}
24 |
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rostools/prodigenr/6d32c84fc3c1faf516e998794a1f00b498597c15/pkgdown/favicon/apple-touch-icon-120x120.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rostools/prodigenr/6d32c84fc3c1faf516e998794a1f00b498597c15/pkgdown/favicon/apple-touch-icon-60x60.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rostools/prodigenr/6d32c84fc3c1faf516e998794a1f00b498597c15/pkgdown/favicon/apple-touch-icon-76x76.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rostools/prodigenr/6d32c84fc3c1faf516e998794a1f00b498597c15/pkgdown/favicon/apple-touch-icon.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rostools/prodigenr/6d32c84fc3c1faf516e998794a1f00b498597c15/pkgdown/favicon/favicon-16x16.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rostools/prodigenr/6d32c84fc3c1faf516e998794a1f00b498597c15/pkgdown/favicon/favicon-32x32.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rostools/prodigenr/6d32c84fc3c1faf516e998794a1f00b498597c15/pkgdown/favicon/favicon.ico
--------------------------------------------------------------------------------
/prodigenr.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: No
4 | SaveWorkspace: No
5 | AlwaysSaveHistory: No
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: knitr
13 | LaTeX: pdfLaTeX
14 |
15 | AutoAppendNewline: Yes
16 | StripTrailingWhitespace: Yes
17 |
18 | BuildType: Package
19 | PackageUseDevtools: Yes
20 | PackageInstallArgs: --no-multiarch --with-keep.source
21 | PackageRoxygenize: rd,collate,namespace,vignette
22 |
23 | UseNativePipeOperator: Yes
24 |
25 | MarkdownWrap: Column
26 | MarkdownWrapAtColumn: 72
27 | MarkdownCanonical: Yes
28 |
--------------------------------------------------------------------------------
/revdep/.gitignore:
--------------------------------------------------------------------------------
1 | checks
2 | library
3 | checks.noindex
4 | library.noindex
5 | data.sqlite
6 | *.html
7 | download
8 | lib
9 | cloud.noindex
10 |
--------------------------------------------------------------------------------
/revdep/README.md:
--------------------------------------------------------------------------------
1 | # Platform
2 |
3 | |field |value |
4 | |:--------|:---------------------------------------------------------------------------------|
5 | |version |R version 4.4.2 (2024-10-31) |
6 | |os |Ubuntu 24.04.1 LTS |
7 | |system |x86_64, linux-gnu |
8 | |ui |RStudio |
9 | |language |(EN) |
10 | |collate |en_US.UTF-8 |
11 | |ctype |en_US.UTF-8 |
12 | |tz |Europe/Copenhagen |
13 | |date |2024-11-30 |
14 | |rstudio |2024.09.0+375 Cranberry Hibiscus (desktop) |
15 | |pandoc |3.2 @ /usr/lib/rstudio/resources/app/bin/quarto/bin/tools/x86_64/ (via rmarkdown) |
16 |
17 | # Dependencies
18 |
19 | |package |old |new |Δ |
20 | |:-----------|:-------|:----------|:--|
21 | |prodigenr |0.6.2 |0.6.2.9000 |* |
22 | |askpass |NA |1.2.1 |* |
23 | |base64enc |0.1-3 |NA |* |
24 | |bslib |0.8.0 |NA |* |
25 | |cachem |1.1.0 |NA |* |
26 | |cli |3.6.3 |3.6.3 | |
27 | |credentials |NA |2.0.2 |* |
28 | |curl |NA |6.0.1 |* |
29 | |digest |0.6.37 |NA |* |
30 | |evaluate |1.0.1 |NA |* |
31 | |fastmap |1.2.0 |NA |* |
32 | |fontawesome |0.5.3 |NA |* |
33 | |fs |1.6.5 |1.6.5 | |
34 | |gert |NA |2.1.4 |* |
35 | |glue |1.8.0 |NA |* |
36 | |highr |0.11 |NA |* |
37 | |htmltools |0.5.8.1 |NA |* |
38 | |jquerylib |0.1.4 |NA |* |
39 | |jsonlite |1.8.9 |1.8.9 | |
40 | |knitr |1.49 |NA |* |
41 | |lifecycle |1.0.4 |NA |* |
42 | |memoise |2.0.1 |NA |* |
43 | |mime |0.12 |NA |* |
44 | |openssl |NA |2.2.2 |* |
45 | |R6 |2.5.1 |NA |* |
46 | |rappdirs |0.3.3 |NA |* |
47 | |rlang |1.1.4 |1.1.4 | |
48 | |rmarkdown |2.29 |NA |* |
49 | |rprojroot |2.0.4 |2.0.4 | |
50 | |rstudioapi |NA |0.17.1 |* |
51 | |sass |0.4.9 |NA |* |
52 | |sys |NA |3.4.3 |* |
53 | |tinytex |0.54 |NA |* |
54 | |whisker |0.4.1 |0.4.1 | |
55 | |withr |3.0.2 |3.0.2 | |
56 | |xfun |0.49 |NA |* |
57 | |yaml |2.3.10 |NA |* |
58 | |zip |NA |2.3.1 |* |
59 |
60 | # Revdeps
61 |
62 |
--------------------------------------------------------------------------------
/revdep/cran.md:
--------------------------------------------------------------------------------
1 | ## revdepcheck results
2 |
3 | We checked 0 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
4 |
5 | * We saw 0 new problems
6 | * We failed to check 0 packages
7 |
8 |
--------------------------------------------------------------------------------
/revdep/failures.md:
--------------------------------------------------------------------------------
1 | *Wow, no problems at all. :)*
--------------------------------------------------------------------------------
/revdep/problems.md:
--------------------------------------------------------------------------------
1 | *Wow, no problems at all. :)*
--------------------------------------------------------------------------------
/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(prodigenr)
3 |
4 | test_check("prodigenr")
5 |
--------------------------------------------------------------------------------
/tests/testthat/test-files.R:
--------------------------------------------------------------------------------
1 | context("Creating some files for project.")
2 |
3 | new_project <- fs::path_temp("testing-docs")
4 | setup_project(new_project)
5 |
6 | test_that("Report and slides created", {
7 | withr::with_dir(new = new_project, {
8 | capture_output(create_slides())
9 | capture_output(create_report())
10 | })
11 |
12 | withr::with_dir(new = file.path(new_project, "docs"), {
13 | expect_true(fs::file_exists("slides.qmd"))
14 | expect_true(fs::file_exists("report.qmd"))
15 | # Needs a Rproj file.
16 | fs::file_delete("../testing-docs.Rproj")
17 | fs::file_delete("slides.qmd")
18 | expect_error(create_slides())
19 | })
20 | })
21 |
22 | fs::dir_delete(new_project)
23 |
--------------------------------------------------------------------------------
/tests/testthat/test-projects.R:
--------------------------------------------------------------------------------
1 | context("Project creation and setup.")
2 |
3 | new_project <- fs::path_temp("testing")
4 | setup_project(new_project)
5 |
6 | # project creation --------------------------------------------------------
7 |
8 | test_that("project is set up", {
9 | expect_true(fs::dir_exists(new_project))
10 |
11 | files_created <- fs::dir_ls(new_project, recurse = TRUE)
12 | folders_created <- fs::dir_ls(new_project, type = "directory")
13 | expect_equal(
14 | sort(basename(folders_created)),
15 | sort(c("R", "docs", "data", "data-raw"))
16 | )
17 |
18 | expect_match(files_created, ".*DESCRIPTION$", all = FALSE)
19 | expect_match(files_created, ".*testing\\.Rproj$", all = FALSE)
20 | })
21 |
22 | test_that("git gets added", {
23 | withr::with_dir(new = new_project, {
24 | fs::dir_delete(".git")
25 | capture_output(setup_with_git())
26 | git_files <- fs::dir_ls(new_project, all = TRUE)
27 | expect_match(git_files, ".*\\.git$", all = FALSE)
28 | expect_match(git_files, ".*\\.gitignore$", all = FALSE)
29 | })
30 | })
31 |
32 | fs::dir_delete(new_project)
33 |
34 | test_that("project checks work correctly", {
35 | expect_error(setup_project(1))
36 |
37 | temp_dir <- tempdir()
38 | proj_with_space <- fs::file_temp("test new", tmp_dir = temp_dir)
39 | expect_warning(setup_project(proj_with_space))
40 | expect_true(fs::file_exists(sub("test new", "test-new", proj_with_space)))
41 | fs::dir_delete(sub("test new", "test-new", proj_with_space))
42 | })
43 |
44 | test_that("project still creates if Git already exists", {
45 | new_project <- fs::path_temp("test-with-git")
46 | fs::dir_create(new_project)
47 | withr::with_dir(new = new_project, {
48 | gert::git_init()
49 | })
50 | expect_message(
51 | setup_project(new_project),
52 | regexp = ".*has [Gg]it.*"
53 | )
54 | expect_true(fs::dir_exists(new_project))
55 | })
56 |
--------------------------------------------------------------------------------
/vignettes/prodigenr.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Getting started with prodigenr"
3 | author: "Luke W. Johnston"
4 | date: "`r Sys.Date()`"
5 | output: rmarkdown::html_vignette
6 | vignette: >
7 | %\VignetteIndexEntry{Getting started with prodigenr}
8 | %\VignetteEngine{knitr::rmarkdown}
9 | ---
10 |
11 | ```{r, echo = FALSE}
12 | knitr::opts_chunk$set(
13 | collapse = TRUE,
14 | comment = "#>",
15 | eval = TRUE
16 | )
17 | ```
18 |
19 | prodigenr, or project directory generator, was designed to simplify the
20 | process of creating new scientific data analysis projects and to help
21 | make your workflow more reproducible and open from the beginning. While
22 | creating individual folders and files manually for new projects doesn't
23 | take too much time, over time and over many researchers, this can
24 | quickly add up to a lot of time! Plus, when a standard structure is
25 | followed it makes it easier to share code and establish reproducible
26 | practices earlier on in the project.
27 |
28 | ## Setting up a project with prodigenr
29 |
30 | Starting a research project? Create a project directory like so:
31 |
32 | ```{r manuscript-proj}
33 | library(prodigenr)
34 | # Create a temporary folder using the fs package
35 | new_project_path <- fs::path_temp("HeartDiseaseExercise")
36 | setup_project(new_project_path)
37 | ```
38 |
39 | Or via RStudio's "New Project" interface (with RStudio version \>1.1).
40 |
41 | The resulting file structure should look something like this:
42 |
43 | ```{r folder-tree, echo=FALSE, comment="", results="markup"}
44 | prodigenr:::viz_project_tree(new_project_path)
45 | ```
46 |
47 | `README.md` files are contained within each project and in each folder
48 | that explains a bit more about what each folder and file are used for,
49 | which is briefly described here:
50 |
51 | - `R/`: Should contain the R scripts and functions used for the
52 | analysis.
53 | - `docs/`: Should contain the files related to presenting the
54 | project's scientific output. Already has the report/manuscript
55 | inside.
56 | - `data/`: If relevant, is where the processed (or simulated) data is
57 | kept that is used for the project as well as the results of the
58 | project's analyses.
59 | - `data-raw/`: If relevant, is where the scripts that process the raw
60 | data into the usable data are kept and, optionally where the raw
61 | data is also kept.
62 | - `DESCRIPTION`: Is a standard file that includes metadata about your
63 | project, in a machine readable format, and that also stores a list
64 | of the R packages your project depends on.
65 | - `.Rproj`: Is a standard file used by RStudio to set some R Project
66 | specific settings.
67 |
68 | To add a new document (e.g. slides, manuscript), run any of the
69 | `create_*()` commands (e.g. `create_slides()`) in the console while in
70 | RStudio in the newly created project (via the `.Rproj` file):
71 |
72 | ```{r example-create-function, eval=FALSE}
73 | # you need to run these in the project's console
74 | create_slides()
75 | ```
76 |
77 | ```{r example-create-functions-hide, echo=FALSE}
78 | # you need to run these in the project's console
79 | withr::with_dir(
80 | new = new_project_path,
81 | code = {
82 | create_slides()
83 | }
84 | )
85 | ```
86 |
87 | Now two more files have been added to the `docs/` folder. The resulting
88 | file structure should look something like this:
89 |
90 | ```{r file-structure-with-doc, echo=FALSE, results="markup", comment=""}
91 | withr::with_dir(fs::path_temp(), {
92 | fs::dir_tree(basename(new_project_path))
93 | })
94 | ```
95 |
96 | At present, there are only two template files that you can view:
97 |
98 | ```{r templates}
99 | template_list
100 | ```
101 |
102 | These template files are what an academic researcher likely typically
103 | encounters. However, if you have a suggestion or want to add a template,
104 | please create a [GitHub
105 | issue](https://github.com/rostools/prodigenr/issues) or submit a [Pull
106 | Request](https://github.com/rostools/prodigenr/pulls)!
107 |
108 | The end goal of each project is to be as self contained as possible. So
109 | that if you ever need to go back to the analysis, it is easy to re-run
110 | the code and get the results that you say you got. This is especially
111 | useful if others such as reviewers ask for something or want to confirm
112 | your results. See the [manifesto](https://rostools.gitlab.io/manifesto)
113 | for more details on the underlying philosophy behind this package.
114 |
115 | ## Related packages or projects
116 |
117 | There are several ways of handling a project. There a few packages that
118 | have similar functionality as `prodigenr` package structure:
119 |
120 | - [`ProjectTemplate`](http://projecttemplate.net/) is well documented
121 | and still actively developed. Only downside is that it is fairly
122 | complicated to use and complex in the project workflow it creates.
123 | - [`makeProject`](https://cran.r-project.org/package=makeProject) is
124 | very simple and stripped down in what it creates and in it's use.
125 | Downside is that it wasn't updated since 2012.
126 | - Use of the R package structure via
127 | [`devtools`](https://cran.r-project.org/package=devtools) (or
128 | [`usethis`](https://cran.r-project.org/package=usethis)), which is
129 | argued for in this
130 | [blog](https://rmflight.github.io/posts/2014/07/vignetteAnalysis.html)
131 | and compared to `ProjectTemplate` in this
132 | [blog](https://rmflight.github.io/posts/2014/07/zpackages_vs_projectTemplate.html)).
133 | - [`rrtools`](https://github.com/benmarwick/rrtools) is very similar
134 | to prodigenr, except it focuses only on manuscripts. Is well thought
135 | out and the documentation is well written.
136 | - [`workflowr`](https://github.com/workflowr/workflowr) is a workflow
137 | for creating online, data science content.
138 |
139 | There is also a list of other similar projects [on the rOpenSci GitHub
140 | repository](https://github.com/ropensci/rrrpkg#useful-tools-and-templates-for-making-research-compendia).
141 | It's up to you to decide which style to use.
142 |
143 | ```{r remove-created-project, include=FALSE}
144 | fs::dir_delete(new_project_path)
145 | ```
146 |
--------------------------------------------------------------------------------