Tuesday, 27 June 2017

Web pages with help about making packages...

Package Root

Got an error message about not being able to find "package root" because I hadn't got the path to the package.
Need to point to the path that contains the package file and all the documentation.
At the moment, I am loading from github not local.


Roxygen tags and NAMESPACES


My first deploy gave me functions from one .R file but not the other.
I needed to add info to the NAMESPACES. This is done by Roxygen but requires the addition of Roxygen tags.
Link about NAMESPACES here:
http://r-pkgs.had.co.nz/namespace.html

Link about Roxygen tags here:
http://kbroman.org/pkg_primer/pages/docs.html

Key was the addition of a Roxygen tag  to each function in the .R file.
#' @export

Detail in the Workflow section on Hadley's Packages book:
http://r-pkgs.had.co.nz/namespace.html#namespace-workflow

Cut and paste:
"The workflow is the same:
  1. Add roxygen comments to your .R files.
  2. Run devtools::document() (or press Ctrl/Cmd + Shift + D in RStudio) to convert roxygen comments to .Rd files.
  3. Look at NAMESPACE and run tests to check that the specification is correct.
  4. Rinse and repeat until the correct functions are exported."

Still have lots to do. Most importantly testing, vignettes and licencing. 

Useful blog post here: 


Stef's post (very inspiring):


Next steps:
  • Adding testing:  http://r-pkgs.had.co.nz/tests.html
  • Adding Vignette






No comments:

Post a Comment