install.packages("devtools")
library(devtools)
::load_all() devtools
Appendix C — Packages FAQ
C.1 Can an .Rproj
file convert an R project into an R package?
The technical answer is no, because the .Rproj
only activates the Build pane in the IDE. The tools in the Build pane are directly connected to the devtools
package (hence the PackageUseDevtools: Yes
in the .Rproj
file).
The seven mandatory fields are required in the DESCRIPTION
to have a functioning R package.
C.2 I have a DESCRIPTION
file with the required fields, but where is the Build pane?
If the mandatory fields are added to the DESCRIPTION
, but the .Rproj
file doesn’t have any of the package configuration fields, then the Build pane will not be displayed (see example below):
C.3 What if my .Rproj
file is configured to work with a package, but my DESCRIPTION
file is missing one (or more) of the required fields?
Setting the Project build tools in your Project Options is insufficient to convert a project into a package. If the .Rproj
file has the package development fields (i.e., Project build tools to Package) but the mandatory fields are missing from the DESCRIPTION
file, the Build pane will be triggered:
But trying to load the code in the R/
folder with Build > Load All (or devtools::load_all()
) we return the following error:
The directory must include a DESCRIPTION
file containing the mandatory fields and an .Rproj
file with the package configuration fields listed above to be a functional R package.
Read more about DESCRIPTION
file fields in R Packages, 2ed
C.4 I have the mandatory fields in my .Rproj
file and DESCRIPTION
, but still no Build pane?
To get the IDE to re-read the .Rproj
file, you might have to terminate the session (Session > Terminate R… > Yes)
This prompts the IDE to re-read the .Rproj
file and trigger the Build pane.