We Made It! 🎉

25 days. Complete modern R package development workflow. From usethis automation to CRAN submission. You have everything you need!

Your Next Steps:
✨ Apply these tools to your packages
📚 Bookmark for reference
🤝 Share knowledge with community
🚀 Build amazing R packages

Thank you for following #RPackageAdvent2025! Now go make the R ecosystem better! 🎄📦
Keep Learning: https://r-pkgs.org | https://usethis.r-lib.org

#rstats #CRAN #RPackageAdvent2025 #ThatsAWrap

Day 25: CRAN Submission Checklist and https://cran-comments.md

Final steps for successful CRAN submission.

Pre-submission checklist:

- devtools::check() passes with 0 errors, warnings, notes
- Test on multiple platforms (rhub, GitHub Actions)
- Update https://NEWS.md and version number
- Check reverse dependencies
- Spell check documentation

#rstats #RPackageAdvent2025

Day 24: rlang - Tidy Evaluation in Packages

Handle user expressions safely in package functions.

Basic tidy evaluation:
my_summarise <- function(data, ...) {
data |>
dplyr::summarise(...)
}

# Embrace operator
my_mutate <- function(data, col, value) {
data |>
dplyr::mutate({{ col }} := value)
}

Pro Tip: Use {{ }} (embrace) for single arguments, ... for multiple arguments.
Resources: https://rlang.r-lib.org

#rstats #RPackageAdvent2025

Day 23: cli - Beautiful Command Line Interfaces

Create user-friendly messages and progress indicators.

Enhanced messages:
cli::cli_alert_success("Package built successfully!")
cli::cli_alert_warning("Missing documentation for {.fn my_function}")
cli::cli_abort("Invalid input: {.val {invalid_value}}")

Pro Tip: Use semantic markup like {.fn function_name} and {.val value} for consistent formatting.
Resources: cli.r-lib.org

#RpackageAdvent2025 #rstats

Day 22: S3, S4, and S7 Object Systems

Create robust object-oriented interfaces with R's object systems.

Pro Tip: Use S3 for simple classes, S4 for complex validation, S7 for modern OOP.
Resources: https://rconsortium.github.io/S7

#rstats #RPackageAdvent2025

Day 21: rhub - Multi-Platform Testing

Test your package on multiple platforms before CRAN submission.

Resources: https://r-hub.github.io/rhub/

#rstats #RPackageAdvent2025

1/ CRAN Tests Everywhere: Windows, macOS, Linux, multiple flavors. Your package must work on all. rhub lets you test before submission.

2/ Run CRAN Checks:
rhub::check_for_cran()

Tests on Debian, Windows, Fedora. Same platforms CRAN uses. Catch platform-specific issues early.

Day 20: Performance Testing with bench

Profile and benchmark your package functions.

Basic benchmarking:

results <- bench::mark(
old_approach = old_function(data),
new_approach = new_function(data),
check = FALSE, # Skip result equality check
iterations = 100
)
plot(results)

Pro Tip: Include benchmarks in your test suite to catch performance regressions.
Resources: https://bench.r-lib.org/

#rstats #RPackageAdvent2025

Day 19: goodpractice - Package Health Checks

Get comprehensive feedback on package quality.

Usage:
goodpractice::gp()

Checks include:
⬩ Function length and complexity
⬩ Namespace usage
⬩ DESCRIPTION completeness
⬩ Code coverage
⬩ R CMD check results

Pro Tip: Run gp() before CRAN submission to catch common issues early.
Resources: github.com/mangothecat/goodpractice

#rstats #RPackageAdvent2025

Day 18: Use linters!

Maintain consistent, readable code style automatically.

Setup:
# .lintr file in project root
linters: linters_with_defaults(
line_length_linter(120),
commented_code_linter = NULL
)

Usage:
lintr::lint_package()
styler::style_pkg()

Pro Tip: Add both to pre-commit hooks for automatic code formatting.
Resources: https://lintr.r-lib.org/

#rstats #RPackageAdvent2025

Day 17: vcr - Recording API Calls for Tests

Record real API responses for reliable, fast tests without hitting live APIs.

Setup:
library(vcr)
vcr_configure(dir = "tests/fixtures/vcr_cassettes")

Pro Tip: Commit cassette files to git for reproducible tests across environments.
Resources: docs.ropensci.org/vcr

#rstats #RPackageAdvent2025