Documentation examples and tests are similar in some ways:
They are self-contained pieces of code.
They should cover the software's most important functions and typical uses.
They should be simple and clear: complex examples are hard for users to understand, and complex test code can introduce testing bugs.
This similarity makes it attractive to use "doctests", which combine
tests and documentation. Indeed, several languages, including Python and Rust,
have doctests built in.^1 R also checks for errors in examples when running R
CMD check
.
https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html
The doctest package extends this idea. It lets you write testthat tests, by adding tags to your roxygen documentation. This helps you check that your examples do what they are supposed to do.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.