I'm learning to build my own packages using RStudio. The current .tar.gz
for the package (named SteenSubsSpec
) is here. Currently the Build & Reload
command appears to build & Roxygen-ize the package successfully. However, the functions do not appear to be loaded into memory, despite the fact Build & Reload
successfully updates the documentation. What am I doing wrong?
Build & Reload
give the following output:
==> roxygenize('.', roclets=c('rd'))
==> R CMD build SteenSubsSpec
* checking for file ‘SteenSubsSpec/DESCRIPTION’ ... OK
* preparing ‘SteenSubsSpec’:
* checking DESCRIPTION meta-information ... OK
* excluding invalid files
Subdirectory 'R' contains invalid file names:
‘2013_08_30_report-concordance.tex’ ‘2013_08_30_report.Rnw’
‘2013_08_30_report.log’ ‘2013_08_30_report.pdf’
‘2013_08_30_report.synctex.gz’ ‘2013_08_30_report.tex’
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
Removed empty directory ‘SteenSubsSpec/inst’
* building ‘SteenSubsSpec_1.0.tar.gz’
Source package written to ~/Dropbox/[my directory]
This updates the documentation: ?write_paper()
displays the current documentation as expected. However
require(SteenSubsSpec)
write_paper()
gives Error: could not find function "write_paper"
Some things that seem to be correct:
R
directory, and have the same name as their definition (e.g /R/write_paper.R
defines write_paper() <- function {...
DESCRIPTION
file contains the names of all the relevant function files: Collate: ... 'write_paper.R
How can I troubleshoot this?
Which function is used for loading packages? Explanation: library() function is used to load a package. library() is not useful when we are developing a package since you have to install the package first. A library is a simple directory containing installed packages.
The default R datasets included in the base R distribution Simply check the checkbox next to the package name to load the package and gain access to the datasets. You can also click on the package name and RStudio will open a help file describing the datasets in this package.
To view the data sets in a package we need to load the package and then use data(). In this way, we will find the list of the data sets available in a package at the bottom of the window that shows all the data sets in base R.
extdata: Extra data used to calculate ID numbers in Yassai et al.'s nomenclature.
Most likely, the functions are not exported to the NAMESPACE file (which you state is currently empty).
In RStudio, under "build tools" in "project options", make sure that "Generate documentation with roxygen" is checked. Then, click on "configure". Make sure that "Use roxygen to generate NAMESPACE file" is also checked.
In your R function files, add an @export yourfunctionname
in there (or, technically, an #' @export yourfunctionname
), and when you build and reload, your NAMESPACE file should be updated and your functions should no longer be invisible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With