Streamlining Your Project Workflow with `projr`
details-gemini.Rmd
Understanding the projr
Workflow
What You’ll Learn:
- How
projr
structures your project for clarity and easy sharing. - The core functions for building and refining your project.
- Simple steps to connect your project to GitHub.
The Heart of projr
: The _projr.yml
File
This file is your project’s command center. Let’s break down its key sections:
-
directories
:- Purpose: Defines where essential project components live.
-
Key Folders:
-
data-raw
: Your untouched, original data. -
cache
: Temporary files created during development. -
output
: Final results you want to share (figures, tables, etc.). -
docs
: Rendered documents (HTML, PDF).
-
-
Benefits:
- Organized structure that’s easy to understand.
- Simplifies sharing specific parts of your project.
-
projr
can smartly manage and protect your outputs.
Use projr_path_get()
to find these folders. Example:
projr_path_get("data-raw")
will return the path to your
data-raw
directory.
-
build
:- Purpose: Automates tasks that happen every time you build your project.
-
Key Actions
- Version Control (Git): Decides how Git commits are linked to project versions.
- Uploads: Effortlessly shares data, outputs, and documents to GitHub, OSF, or local folders.
Building Your Project: Key Functions
Let’s look at the two functions that are the heart of building your project:
-
projr_build_dev()
- Purpose: Your development buddy! Renders your code documents, with results temporarily saved to the “cache” folder.
- Why Use It: Test changes safely before finalizing your outputs.
-
projr_build_output()
-
Purpose: The final production step. This saves
results to their final locations and handles versioning,
uploads, and other tasks you’ve set in
_projr.yml
.
-
Purpose: The final production step. This saves
results to their final locations and handles versioning,
uploads, and other tasks you’ve set in
Notes on Git and GitHub
projr
makes using Git easy, streamlining your version
control and project sharing workflow. Here’s how to connect your project
to GitHub:
- Create a free GitHub account: Sign up on GitHub: https://github.com.
- GitHub Credentials: Follow the steps from Happy Git with R: https://happygitwithr.com/https-pat#tldr (See below for a quick summary).
Generate a GitHub PAT:
if (!requireNamespace("usethis", quietly = TRUE)) {
install.packages("usethis")
}
usethis::create_github_token()
Copy the generated token.
Save Your Credentials:
gitcreds::gitcreds_set()
Paste your Git credentials when prompted.
Next Steps
-
Experiment: Create a test project to practice using
projr
. -
Customize: Tailor your
_projr.yml
file to match your specific project’s needs. Check out the3-directories
and4-destination
vignettes for more details! -
Integrate: Make
projr
a natural part of your R workflow.
Let’s transform your projects from chaotic to streamlined!