Demystifying complex technical concepts: R packages

Building confidence through simplified learning

Javi Rudolph

April 30, 2025

Hello, I’m Javi!

  • Posit mentor since 2022
  • Disease ecologist
  • Believer in simplifying the complex
  • Organizing stuff with packages since 2019

Why are we here today?

Building confidence through demystification

  • As mentors, our job is to make complex concepts accessible
  • Package development can seem like uncharted territory
  • But it doesn’t have to be!

The ‘Complex Thing’: R Package Development

Why does it feel intimidating?

  • “It’s only for R wizards and tidyverse experts”
  • “Steep learning curve. There’s so much to learn at once”
  • “I don’t have a computer science background – can I really do this?”

The Learner Experience

A LOT of overwhelm

  • “Where do I even start?”
  • “So many files and folders!”
  • “DESCRIPTION, NAMESPACE… what are these?”
  • “Documentation looks complicated”

Remember how YOU felt when you first learned about R packages!

My experience

Learning R over a decade ago with a pdf

My Approach to Teaching This

Reframing the Concept

Forget about an “R package” - think of organization

We are just organizing your work:

  1. Functions in logical files
  2. Documentation that’s useful
  3. Making code reusable
  4. Sharing with others

Context Matters

Start with “WHY”

Why Build a Package?

From the learners perspective

  • Share reusable work
    • Document utility functions
    • Package widely used workflows
    • Include example datasets with code
  • Highlight sharing within teams!

Present a Small Win

Turn ONE function into a package

  • Following first chapter in R Packages book
  • Creates immediate sense of accomplishment
  • Shows the core workflow in microcosm

Demo Time!

Live code in ~25 minutes

  1. Create package structure with usethis::create_package()
  2. Add a simple function from milestone (using ifelse not if_else)
  3. Document with roxygen comments
  4. Build and check
  5. Install and use!

Keep it casual & relaxed - Show your mistakes and fixes - Demonstrate the iterative cycle

The Development Cycle

  1. Write/edit function
  2. Document (Ctrl+Shift+D)
  3. Load (Ctrl+Shift+L)
  4. Test in console
  5. Repeat!

What I Don’t Include (Yet)

Keeping it simple is key!

  • Git/GitHub integration
    • Can be taught separately
  • Unit testing
    • Introduce after basics are solid
  • Complex dependencies
    • Start with base R functions

The Mentoring Mindset

Co-exploration, Not Expertise Delivery

“I’m not here to have all the answers. I’m here to figure things out alongside you.”

  • Create space for joint problem-solving
    • “I forgot the order of document() and load()
  • Normalizing not knowing everything
    • Understanding outputs of usethis and errors
  • Build confidence through collaboration
    • “Can someone tell me what our first function was?”

Celebrate Mini-Milestones!

  • First working function
  • First successful documentation
  • First package install
  • First time using your own package

Success Story

Manager who shared scripts but never built packages

  • Initially intimidated by package development
  • Attended a collaborative session like this
  • Built a package for team utility functions
  • Later hosted it on organizational GitHub
  • Inspired others on the team!

Visit their blog

Lessons Learned

  • Version control + packages = too much at once
  • Seeing a package built live is powerful
  • Understanding packages ≠ having to build them
  • Exploring others’ packages builds confidence
    • Navigating GitHub packages

Discussion Time

Discussion Questions

Posted on retrotool board

  1. How do you recognize and defuse fear in your learners?

  2. What’s one topic you’ve hesitated to teach because it felt too complex?

  3. What techniques do you use to simplify difficult material?

  4. How could you take a complex topic and make it teachable?

Thank You!