Streamlining Your Project Workflow with `projr`
details-gemini.RmdUnderstanding the projr Workflow
What You’ll Learn:
- How
projrstructures 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:
-
raw-data: 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.
-
projrcan smartly manage and protect your outputs.
Use projr_path_get() to find these folders. Example:
projr_path_get("raw-data") will return the path to your
raw-data 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.ymlfile to match your specific project’s needs. Check out the3-directoriesand4-destinationvignettes for more details! -
Integrate: Make
projra natural part of your R workflow.
Let’s transform your projects from chaotic to streamlined!