Skip to content

Mylonas/r_template

r_template

A GitHub template for creating R packages with CI, testing, and standard project structure pre-configured.

R CMD Check

Use this template

Click Use this template on GitHub to create a new repo, then:

# Install devtools if needed
install.packages("devtools")

# Rename the package in DESCRIPTION
# Replace 'mypkg' with your package name throughout

# Install dependencies
devtools::install_deps()

# Run tests
devtools::test()

# Check the package
devtools::check()

Structure

.
├── DESCRIPTION          # Package metadata — name, version, author, dependencies
├── NAMESPACE            # Exports (auto-generated by roxygen2, do not edit by hand)
├── LICENSE
├── R/
│   └── hello.R          # Example function — replace with your own
├── tests/
│   ├── testthat.R
│   └── testthat/
│       └── test-hello.R # Example tests using testthat
└── .github/
    └── workflows/
        └── blank.yml    # R CMD Check CI across ubuntu/windows/macos × release/devel

Customise

  1. DESCRIPTION — update Package, Title, Description, Authors@R, and any Imports/Suggests
  2. R/ — add your functions, one file per logical group, documented with roxygen2
  3. tests/testthat/ — add test files named test-<filename>.R
  4. NAMESPACE — regenerate with devtools::document() after updating roxygen2 docs

CI

The included workflow runs R CMD check on Ubuntu, Windows, and macOS against both the current release and development versions of R on every push and pull request.

About

A template for creating a package in R.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors