Getting started with prodigenr

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = TRUE
)

prodigenr, or project directory generator, was designed to simplify the process of creating new data analysis projects and to help make your workflow more reproducible from the beginning. Standard files and folders are created for specific projects (e.g. abstracts or manuscripts). While creating individual folders and files manually for new projects doesn't take too much time, over time and over many researchers, this can quickly add up to a lot of time! Plus, when a standard structure is followed it makes it easier to share code and establish reproducible practices earlier on in the project.

Setting up a project with prodigenr

Starting a research project? Create a project directory like so:

library(prodigenr)
# Create a temporary folder using the fs package
new_project_path <- fs::path_temp("HeartDiseaseExercise")
setup_project(new_project_path)

Or via RStudio's interface (with RStudio version >1.1):

Creating a prodigenr project in RStudio

The resulting file structure should look something like this:

prodigenr:::viz_project_tree(new_project_path)

README.md files are contained within each project and in each folder that explains a bit more about what each folder and file are used for, which is briefly described here:

To add a new document (e.g. slides, manuscript), run any of the create_*() commands (e.g. create_manuscript()) in the console while in RStudio in the newly created project (via the .Rproj file):

# you need to run these in the project's console
create_manuscript()
create_slides()
# you need to run these in the project's console
withr::with_dir(
    new = new_project_path,
    code = {
        create_manuscript()
        create_slides()
    }
)

Now two more files have been added to the doc/ folder. The resulting file structure should look something like this:

withr::with_dir(fs::path_temp(), {fs::dir_tree(basename(new_project_path))})

At present, there are only two template files that you can view:

template_list

These template files are what an academic researcher likely typically encounters. However, if you have a suggestion or want to add a template, please create a Github issue or submit a Pull Request!

The end goal of each project is to be as self contained as possible. So that if you ever need to go back to the analysis, it is easy to re-run the code and get the results that you say you got. This is especially useful if others such as reviewers ask for something or want to confirm your results. See the manifesto for more details on the underlying philosophy behind this package.

Related packages or projects

There are several ways of handling a project. There a few packages that have similar functionality as prodigenr package structure:

There is also a list of other similar projects on the rOpenSci GitHub repository. It's up to you to decide which style to use.



Try the prodigenr package in your browser

Any scripts or data that you put into this service are public.

prodigenr documentation built on June 2, 2021, 5:07 p.m.