Short Course on R Tools
CRAN submission and Collaborate via GitHub
Mehdi Maadooliat and Hossein Haghbin
Marquette University
SCoRT - Summer 2025
1. CRAN Submission: Overview
CRAN is the Comprehensive R Archive Network β the main repository for R packages.
Submitting to CRAN means:
- β
Your package is publicly available
- π§ͺ It passes strict quality checks
- π It becomes accessible via
install.packages("yourpkg")
2. Requirements Before Submission
Make sure your package:
- Passes
R CMD check with no ERRORs, no WARNINGs, and no (avoidable) NOTEs
- Has proper documentation for all exported functions
- Has a valid
LICENSE
- Uses a CRAN-acceptable package name
- Has examples that run in < 5 seconds
3. Handling NOTEs and WARNINGs
Some NOTEs are common (e.g., missing author ORCID), butβ¦
β Never submit to CRAN with unaddressed ERRORs or WARNINGs
To reduce NOTEs:
- Add your ORCID via
Authors@R
- Ensure
Title and Description are plain text
- Avoid using
cat() or print() in package code unless essential
4. Simulate a CRAN Check π§ͺ
Use rhub to simulate CRAN checks on different platforms:
Or test specific platforms:
rhub::check(platform = "windows-x86_64-release")
β
This helps catch issues that only appear on Windows or macOS.
5. Submit to CRAN
Use the devtools helper:
This will:
- Check your package one final time
- Ask you to confirm
- Open the CRAN web form in your browser
- Help generate an email to CRAN maintainers
π¬ What Happens After Submission?
- Youβll get an automated confirmation email
- Within ~24β72 hours, a CRAN maintainer will review your package
- They may:
- Accept it immediately β
- Request fixes or clarifications βοΈ
- Reject with detailed reasons β
π Updating a CRAN Package
To submit an update:
- Bump the version (e.g., from 1.0.0 β 1.0.1)
- Add a clear
NEWS.md entry
- Ensure compatibility with current R version and dependencies
- Follow the same submission process
π You can only submit once every 1β2 weeks (per package).
6. Collaborate via GitHub
π Version Control Essentials
- Track and restore changes in code over time
- Collaborate without overwriting othersβ work
- Revert to earlier working versions if bugs appear
π Tools Used:
git (local)
GitHub (remote)
RStudio (IDE)
π¦ Example: You change a function in plot_utils.R, commit it with message βRefactor histogram labelsβ, and push to GitHub to share with team.
π¬ Example: Rfssa Package Github
π Git & GitHub Basics
- πΉGit: Version control system for your local project
- πΉGitHub: Cloud platform to share and collaborate
π Key Terms:
- Commit = Savepoint
- Push/Pull = Send/Receive changes
- Repo = Project folder
π¦ Example: You push your R package to GitHub, allowing your coauthor to edit documentation and submit a pull request.
π¦ Installing Git
- πΉ Go to git-scm.com
- Choose your operating system:
- Windows: Download
.exe and install with default options
- macOS: Install via Homebrew
brew install git or Git installer
- Linux: Use package manager, e.g.:
π§ͺ Verifying Git Installation
π§ͺ Run this in your Terminal (or Command Prompt):
β
You should see something like:
π‘ If this works, Git is installed correctly!
π Configuring Git Identity
π§ Set your global Git identity:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
β
To check the name or email currently set in Git, use these commands:
git config --global user.name
git config --global user.email
π§ͺ Check Setup
Use this helpful diagnostic tool:
π‘ This tells you:
- Whether Git is installed
- Whether GitHub is connected
- If PAT is stored
π Connect to GitHub
Run this to create and link a GitHub repo:
This will:
- Push your project to GitHub
- Open the new repo in your browser
π‘ You can now push/pull changes from RStudio Git tab
π₯ Demo: Rfssa Github Package
Resources & Further Reading
π Thank you!
Questions & Discussion