R package organisation is quite straigth forward:
R
folder.man
folder.data
folder.tests
folder contains the unnitest runned during compilationvignettes
are also available in their own folder to explain more the codes.Each function are preceded by ROxygen comment to render the documentation of each function.
To transfer those ROxygen comment to Rd files in the man
folder, run:
devtools::document()
One good guidelines that could be followed is the one from the TidyVerse. It explains how to name files, functions, variable, for analyses and packages. It also add information on how to nicely write the code: space, indentations, ...
All those guidelines can be automatically detected and applied to a package with styler package.
One objective would be to add tests for each functions and for each conditions.
For that we use the package test_that.
For a given function a linked test file can be created in the test/testthat/
folder with
use_test("function_name")
When the test is added inside the file it will be ran during compilation or can be done with:
devtools::test()
To see the coverage of the generated code you can use:
library(covr)
# If run with no arguments implicitly calls `package_coverage()`
report()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.