Rpacker creates templates and wraps usethis and devtools to quickly setup an R package, write functions, tests and documentation.
Install from GitHub:
install.packages("devtools")
library(devtools)
install_github("AntonioJBT/Rpacker")
Quickly setup a skeleton directory with file templates for an R package:
library(Rpacker)
setwd('/a_reasonable/parent/directory/like/my_github_repos')
# Generate all the files and directories needed for an R package using the devtools workflow:
rpac_all_setup(pkg_name = 'packageTest',
path = '.',
first = 'Super',
last = 'Duper',
email = 'super@duper.com',
pkgs = 'dummy_holder',
github_user = 'SuperDuper'
)
This will give you e.g.:
├── .Rbuildignore
├── .gitignore
├── .travis.yml
├── DESCRIPTION
├── LICENSE.md
├── NAMESPACE
├── R
│ └── testPackage-package.R
├── README.md
├── codecov.yml
├── cran-comments.md
├── testPackage.Rproj
├── tests
│ ├── testthat
│ └── testthat.R
└── vignettes
├── .gitignore
└── introduction_testPackage.Rmd
Generate templates for each new function and test you add:
# Generate a file template for a function using roxygen2 for documentation:
rpac_function(function_name = 'rpac_test',
pkg_name = 'testPackage',
path = 'R',
author = 'Super Duper',
github_user = 'SuperDuper',
level = 'short',
open = TRUE # tries to open file
)
# Generate a file template for code tests to run with testthat:
rpac_test_template(test_name = 'rpack_test_template',
pkg_name = 'packageTest',
path = 'tests/testthat/'
)
# Add some boilerplate code to the same file for additional functions to test:
rpac_add_test(test_name = 'rpack_test_template',
function_name = 'function_to_test',
path = 'tests/testthat',
append = TRUE,
open = TRUE
)
See the devtools workflow, check the R packages book and the official R reference.
Pull requests welcome
If you have any issues, pull requests, etc. please report them in the issue tracker.
Not released:
Current release:
Previous:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.