Search
108 results for “Drmowinckels”
-
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 resultsPro Tip: Run gp() before CRAN submission to catch common issues early.
Resources: github.com/mangothecat/goodpractice -
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/ -
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 -
Day 16: Testing with Mocks using testthat
Test functions that depend on external resources using testthat's built-in mocking.Pro Tip: Use local_mocked_bindings() to mock functions within the test scope only.
Resources: testthat.r-lib.org -
Day 15: Snapshot Testing with testthat
Test complex outputs that are hard to specify exactly.
Text snapshots:
test_that("error messages are informative", {
expect_snapshot(my_function(bad_input), error = TRUE)
})Pro Tip: Review snapshot changes carefully - they capture everything, including whitespace and formatting.
-
Day 14: testthat 3rd Edition Features
Modern testing with the latest testthat features.Setup:
usethis::use_testthat(3)New features:
# Snapshot tests
test_that("plot output is stable", {
p <- my_plot(data)
vdiffr::expect_doppelganger("basic-plot", p)
})Helper functions in tests/testthat/helper.R
Pro Tip: Use test_that() with descriptive names that explain what should happen.
Resources: https://testthat.r-lib.org -
Day 13: covr - Test Coverage Reporting
Track how much of your code is tested.
use #nocov for code you don't want to cover (like basic R functions etc)Basic usage:
covr::package_coverage()
covr::report()Integration with CI:
usethis::use_github_action("test-coverage")
usethis::use_coverage() # Adds codecov badgePro Tip: Aim for >80% coverage, but focus on testing critical functions thoroughly rather than chasing 100%.
Resources: https://covr.r-lib.org -
Day 12: README.Rmd Automation
Create dynamic READMEs that stay up-to-date with your code.
Setup:
usethis::use_readme_rmd()Include these sections:
• Installation instructions
• Basic usage example
• Lifecycle badges
• Build status badgesKeep it fresh:
# Add to .github/workflows/
- name: Render README
run: Rscript -e 'rmarkdown::render("README.Rmd")' -
Day 11: https://NEWS.md and Semantic Versioning
Keep users informed about package changes.Create https://NEWS.md:
usethis::use_news_md()Structure:
# mypackage 1.2.0## New features
* Added `new_function()` for advanced analysis (#15)## Bug fixes
* Fixed issue with missing values in `existing_function()` (#12)Pro Tip: Follow semantic versioning: MAJOR.MINOR.PATCH for breaking.feature.bugfix changes.
-
Day 10: lifecycle - Managing Function Deprecation
Communicate changes to users gracefully with lifecycle badges.
Setup:
usethis::use_lifecycle()#' @lifecycle experimental
new_function <- function() {
# function body
}Pro Tip: Use lifecycle stages: experimental → stable → superseded → deprecated.
Resources: https://lifecycle.r-lib.org
#rstats #RPackageAdvent2025 -
Day 9: Vignettes with knitr and rmarkdown
Create comprehensive tutorials and examples for your package.
Add a vignette:
usethis::use_vignette("getting-started")Vignette best practices:
● Start with a clear problem statement
● Show realistic examples
● Keep computational time under 5 minutes
● Use pre-computed results for heavy computationsPro Tip: Use knitr::opts_chunk$set(collapse = TRUE, comment = "#>") for clean output.
#rstats #RPackageAdvent2025 -
Day 8: pkgdown Customization and Deployment
Transform your package documentation into a polished website.
Advanced customization:
# _pkgdown.yml
template:
params:
bootswatch: flatlyreference:
- title: "Data manipulation"
contents:
- starts_with("mutate")
- ends_with("_join")Auto-deployment:
usethis::use_github_action("pkgdown")Pro Tip: Group functions logically in the reference section for better navigation.
#rstats #RPackageAdvent2025 -
The Bottom Line: Manually editing DESCRIPTION = typos, wrong formatting, forgotten versions. usethis = automatic, correct, sorted. Let the tool handle the details so you focus on code.
Tomorrow: Advanced roxygen2 for better documentation! 📝Resources: https://usethis.r-lib.org
#rstats #usethis #Dependencies #RPackageAdvent2025 -
Day 6/25: Adding dependencies to your #rstats package 🧵
The Manual DESCRIPTION Problem: You need to add dplyr to your package. Open DESCRIPTION, find Imports, type "dplyr," hope you didn't typo it, wonder if you need a version constraint, forget to sort alphabetically. Then your package fails R CMD check.
usethis Does It Right:
usethis::use_package("dplyr")Adds to Imports section, alphabetically sorted, with correct formatting. One command, zero mistakes.
-
Day 4: .Rbuildignore and .gitignore Best Practices 📁
Control what gets included in your package build and git repository! 🎯
💡 Pro Tip: Use usethis::use_build_ignore() to add entries programmatically.
#rstats #BestPractices #Git #RPackageAdvent2025 🗃️ -
Day 3: GitHub Actions with r-lib/actions - CI/CD Setup 🚀
Automate your package testing across multiple platforms and R versions! 🔄
Quick setup: ⚡💡 Pro Tip: The standard check runs on Windows, macOS, and Ubuntu with
multiple R versions.📚 Resources: https://github.com/r-lib/actions
-
Day 2: devtools - Essential Development Workflow 🔧
The devtools package streamlines your package development workflow with key functions! ⚡
💡 Pro Tip: Use Ctrl/Cmd + Shift + L in RStudio to quickly run load_all().
📚 Resources: https://devtools.r-lib.org
-
Day 1: usethis - Project Setup Automation 🎯
The usethis package is your best friend for automating repetitive package development tasks! 🤖
💡 Pro Tip: Set up your global options once with usethis::edit_r_profile() to add your name, email, and preferred license.
📚 Resources: https://usethis.r-lib.org
#RPackageDev #RStats #usethis #RPackageAdvent2025 📦 -
How to Follow Along:
I'll post daily starting Dec 1st
Each post includes practical code examples
Follow the #RPackageAdvent2025 hashtag
Comment with your questions - I'll answer!
Share your favorite tips with the communityWhy I'm Doing This: I've developed multiple R packages and learned these lessons the hard way. My goal is to save you time, frustration, and help you build better packages that users love.
Ready to level up your R package game? See you December 1st! 🚀 -
🎄 ANNOUNCEMENT: R Package Development Advent Calendar 2025! 🎄
Starting December 1st, I'm launching a 25-day journey through modern R package development. But this isn't just another tips series - here's why you should follow along 🧵
The Problem: R package development can feel overwhelming. Between documentation, testing, CI/CD, and CRAN submission, there are dozens of tools to learn.
-
@maelle this is such a fun and nerdy pillow! You should add a #saperlipopette to it too 🤩
-
I got us a Niimbot label maker for Christmas. We've been doing some storage upgrades after the shelves in our pantry fell apart. I've wanted one for ages, so it was a good excuse. Now we can make lovely legible labels on our stuff!
Xmas boxes first of course!
-
Our lab is looking for a principal engineer in neuroimaging.
The position is suited for a person with an interest in and experience with signal and image processing. Imaging of the human brain by MRI and PET is central to LCBC research
Developing and maintaining existing data pipelines and infrastructure (MRI, PET and EEG)
Maintaining collection of behavioral and questionnaire data
Taking responsibility for quality control of collected data -
-
Cerebellar flatmaps now in #ggsegverse!
We have now shipped across the ggsegverse the possibility to visualise the cerebellum parcellations also, based on the SUIT flatmap from the Diedriksen lab.
Read more about it https://ggsegverse.github.io/news/cerebellar-support/
-
Cerebellar flatmaps now in #ggsegverse!
We have now shipped across the ggsegverse the possibility to visualise the cerebellum parcellations also, based on the SUIT flatmap from the Diedriksen lab.
Read more about it https://ggsegverse.github.io/news/cerebellar-support/
-
Cerebellar flatmaps now in #ggsegverse!
We have now shipped across the ggsegverse the possibility to visualise the cerebellum parcellations also, based on the SUIT flatmap from the Diedriksen lab.
Read more about it https://ggsegverse.github.io/news/cerebellar-support/
-
Cerebellar flatmaps now in #ggsegverse!
We have now shipped across the ggsegverse the possibility to visualise the cerebellum parcellations also, based on the SUIT flatmap from the Diedriksen lab.
Read more about it https://ggsegverse.github.io/news/cerebellar-support/
-
New ggsegverse update!
I finally got around to pre-release new ggseg.extra (notice name change) package, for creating new atlases.
https://ggsegverse.github.io/news/ggseg.extra/
It's full of new features, and likely lots of new bugs.
I'd love folks to test how it works, I've really tried making things more robust and I hope its payed off! -
New ggsegverse update!
I finally got around to pre-release new ggseg.extra (notice name change) package, for creating new atlases.
https://ggsegverse.github.io/news/ggseg.extra/
It's full of new features, and likely lots of new bugs.
I'd love folks to test how it works, I've really tried making things more robust and I hope its payed off!