devtools 1.12.0

Tools to Make Developing R Packages Easier


Platform: CRAN

Language: R

License: GPL-2.0+

View on registry:


Direct download link:


Build Status AppVeyor Build Status Coverage Status CRAN_Status_Badge

The aim of devtools is to make package development easier by providing R functions that simplify common tasks.

An R package is actually quite simple. A package is a template or set of conventions that structures your code. This not only makes sharing code easy, it reduces the time and effort required to complete you project: following a template removes the need to have to think about how to organize things and paves the way for the creation of standardised tools that can further accelerate your progress.

While package development in R can feel intimidating, devtools does every thing it can to make it less so. In fact, devtools comes with a small guarantee: if you get an angry e-mail from an R-core member because of a bug in devtools, forward me the email and your address and I'll mail you a card with a handwritten apology.

devtools is opinionated about package development. It requires that you use roxygen2 for documentation and testthat for testing. Not everyone would agree with this approach, and they are by no means perfect. But they have evolved out of the experience of writing over 30 R packages.

I'm always happy to hear about what doesn't work for you and where devtools gets in your way. Either send an email to the rdevtools mailing list or file an issue at the GitHub repository.

Updating to the latest version of devtools

You can track (and contribute to) the development of devtools at To install it:

  1. Install the release version of devtools from CRAN with install.packages("devtools").

  2. Make sure you have a working development environment.

    • Windows: Install Rtools.
    • Mac: Install Xcode from the Mac App Store.
    • Linux: Install a compiler and various development libraries (details vary across different flavors of Linux).
  3. Install the development version of devtools.


Package development tools

All devtools functions accept a path as an argument, e.g. load_all("path/to/path/mypkg"). If you don't specify a path, devtools will look in the current working directory - this is recommended practice.

Frequent development tasks:

  • load_all() simulates installing and reloading your package, loading R code in R/, compiled shared objects in src/ and data files in data/. During development you usually want to access all functions so load_all() ignores the package NAMESPACE. load_all() will automatically create a DESCRIPTION if needed.

  • document() updates documentation, file collation and NAMESPACE.

  • test() reloads your code, then runs all testthat tests.

Building and installing:

  • install() reinstalls the package, detaches the currently loaded version then reloads the new version with library(). Reloading a package is not guaranteed to work: see the documentation to unload() for caveats.

  • build() builds a package file from package sources. You can use it to build a binary version of your package.

  • install_* functions install an R package:

    • install_github() from github,
    • install_bitbucket() from bitbucket,
    • install_url() from an arbitrary url and
    • install_local() from a local file on disk.
    • install_version() installs a specified version from cran.

Check and release:

  • check() updates the documentation, then builds and checks the package. build_win() builds a package using win-builder, allowing you to easily check your package on windows.

  • run_examples() will run all examples to make sure they work. This is useful because example checking is the last step of R CMD check.

  • check_man() runs most of the documentation checking components of R CMD check

  • release() makes sure everything is ok with your package (including asking you a number of questions), then builds and uploads to CRAN. It also drafts an email to let the CRAN maintainers know that you've uploaded a new package.

Other tips

I recommend adding the following code to your .Rprofile:

.First <- function() {
    repos = c(CRAN = ""),
    browserNLdisabled = TRUE,
    deparse.max.lines = 2)

if (interactive()) {

See the complete list in ?devtools

This will set up R to:

  • always install packages from the RStudio CRAN mirror
  • ignore newlines when browse()ing
  • give minimal output from traceback()
  • automatically load devtools in interactive sessions

There are also a number of options you might want to set (in .Rprofile) to customise the default behaviour when creating packages and drafting emails:

  • your name, used to sign emails
  • your R author string, in the form of "Hadley Wickham <[email protected]> [aut, cre]". Used when creating default DESCRIPTION files.
  • devtools.desc.license: a default license used when creating new packages

Code of conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Suggests Dependencies Requirements Latest Stable Latest Release Licenses
curl >= 0.9 0.9.7 2.5 MIT
Explore the resolved suggests dependency tree for devtools 1.12.0
Imports Dependencies Requirements Latest Stable Latest Release Licenses
digest * 0.6.12 0.6.12 GPL-2.0+
httr >= 0.4 1.2.1 1.2.1 MIT
jsonlite * 0.9.22 1.4 MIT
memoise >= 1.0.0 1.1.0 1.1.0 MIT
methods *
rstudioapi >= 0.2.0 0.4.0 0.6 MIT
stats *
tools *
utils *
whisker * 0.3-2 GPL-3.0
withr * 1.0.2 1.0.2 GPL-2.0+
Explore the resolved imports dependency tree for devtools 1.12.0
Depends Dependencies Requirements Latest Stable Latest Release Licenses
R >= 3.0.2
Explore the resolved depends dependency tree for devtools 1.12.0


1.12.0 June 24, 2016
1.11.1 April 21, 2016
1.11.0 April 12, 2016
1.10.0 January 23, 2016
1.9.1 September 11, 2015
1.8.0 May 09, 2015
1.7.0 January 17, 2015
1.6.1 October 07, 2014
1.6 September 23, 2014
1.5 April 07, 2014
See all 26 releases

Project Statistics

SourceRank 19
Dependencies 0
Dependent projects 80
Dependent repositories 487
Total releases 26
Latest release
First release
Stars 1.44K
Forks 509
Watchers 139
Contributors 87
Repo Size: 3.54 MB

Top Contributors See all

Hadley Wickham Winston Chang Jim Hester Kirill Müller Jennifer (Jenny) Bryan Robert M Flight kohske takahashi Lev Kuznetsov Kevin Ushey Geoff99 Yoni Ben-Meshulam ashander Facundo Muñoz Gábor Csárdi Ben Bond-Lamberty Robert Krzyzanowski Jeroen Ooms Yihui Xie Andy Teucher Henrik Bengtsson

Something wrong with this page? Make a suggestion

Export .ABOUT file for this library

Last synced: 2017-03-27 13:04:34 UTC

Login to resync this project