home.social

Search

108 results for “Drmowinckels”

  1. 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

  2. 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: lintr.r-lib.org/

  3. 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

  4. 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

  5. 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.

  6. 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: testthat.r-lib.org

  7. Day 13: covr - Test Coverage Reporting

    Track how much of your code is tested.
    use 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 badge

    Pro Tip: Aim for >80% coverage, but focus on testing critical functions thoroughly rather than chasing 100%.
    Resources: covr.r-lib.org

  8. 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 badges

    Keep it fresh:

    # Add to .github/workflows/
    - name: Render README
    run: Rscript -e 'rmarkdown::render("README.Rmd")'

  9. Day 11: NEWS.md and Semantic Versioning
    Keep users informed about package changes.

    Create 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.

  10. 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: lifecycle.r-lib.org

  11. 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 computations

    Pro Tip: Use knitr::opts_chunk$set(collapse = TRUE, comment = "#>") for clean output.

  12. Day 8: pkgdown Customization and Deployment

    Transform your package documentation into a polished website.

    Advanced customization:

    # _pkgdown.yml
    template:
    params:
    bootswatch: flatly

    reference:
    - 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.

  13. 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: usethis.r-lib.org

  14. Day 6/25: Adding dependencies to your 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.

  15. 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.
    🗃️

  16. 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: github.com/r-lib/actions

  17. 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: devtools.r-lib.org


    🛠️

  18. 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: usethis.r-lib.org
    📦

  19. How to Follow Along:

    I'll post daily starting Dec 1st
    Each post includes practical code examples
    Follow the hashtag
    Comment with your questions - I'll answer!
    Share your favorite tips with the community

    Why 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! 🚀

  20. 🎄 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.

  21. @maelle this is such a fun and nerdy pillow! You should add a to it too 🤩

  22. 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!

  23. 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

    jobbnorge.no/en/available-jobs

  24. Once I figre this thing out, I'll likely be posting lots of #rstats #neuro #cogneuro and #rse stuff

  25. 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 ggsegverse.github.io/news/cere

    #rstats #neuroimaging #cerebellum

  26. 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 ggsegverse.github.io/news/cere

    #rstats #neuroimaging #cerebellum

  27. 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 ggsegverse.github.io/news/cere

    #rstats #neuroimaging #cerebellum

  28. 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 ggsegverse.github.io/news/cere

    #rstats #neuroimaging #cerebellum

  29. New ggsegverse update!

    I finally got around to pre-release new ggseg.extra (notice name change) package, for creating new atlases.

    ggsegverse.github.io/news/ggse

    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!

    #rstats #ggsegverse #neuroimaging

  30. New ggsegverse update!

    I finally got around to pre-release new ggseg.extra (notice name change) package, for creating new atlases.

    ggsegverse.github.io/news/ggse

    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!

    #rstats #ggsegverse #neuroimaging