
To be fully capable of building R packages from source, you’ll also need a compiler and a few other command line tools. 3.2.1 Personal startup configurationĭevtools :: install_github ( "r-lib/devtools" ) devtools :: install_github ( "r-lib/usethis" ) 3.3 R build toolchain
If you choose to specify the namespace, such as when working in a more programmatic style, then make sure you qualify the call with usethis, e.g., usethis::use_testthat(). Then you can use any function in usethis without qualification, e.g., just call use_testthat(). devtools makes it easy to access usethis functions interactively, as when when you call library(devtools), usethis is also attached. It holds the functions that act on the files and folders in an R project, most especially for any project that is also an R package. The usethis package is the one constituent package that more people may be aware of and that they may use directly. The help for devtools::fcn() usually states when devtools is re-exporting a function from another package. If you find bugs, try to report them on the package that is a function’s primary home.For example, if you are creating a function in your package in which you need to query the state of the user’s R session, use sessioninfo::session_info() in your package instead of devtools::session_info(). Instead, pkg should be the package where fcn() is defined. devtools should rarely appear in the role of pkg in a qualified call of the form pkg::fcn().
#R 3.3.2 in cakebrew code#
If you are using functions from devtools and friends within the package code you are writing, you should NOT depend on devtools, but should instead access functions via the package that is their primary home. In this case you should attach devtools with library(devtools) and call the functions without qualification (e.g., load_all()). If you are using the functions interactively to help you develop your package, you should think of devtools as the provider of your favorite functions for package development. What’s our recommended approach to using devtools and its constituent packages? It varies, depending on your intention: In some cases it simply re-exports a function from another package to make it easily available when devtools is attached. For example, devtools might provide a wrapper function in order to set user-friendly defaults, introduce helpful interactive behaviour, or to combine functionality from multiple sub-packages. 3.2 devtools, usethis, and youĪs mentioned in Section 1.1, devtools is a ‘meta-package’, encompassing and exposing functionality maintained in several smaller packages 1. Most readers can use the free, open source version of RStudio Desktop. New versions are released regularly, so we recommend updating often to get access to the latest and greatest features.ĭownload the current version of RStudio Desktop here. Make sure you have a recent version of the RStudio integrated development environment (IDE). Install.packages ( c ( "devtools", "roxygen2", "testthat", "knitr" ) )