Documenting functions
- Most commonly documented object
- Three common tags:
@param name description
: describes the function’s inputs or parameters.
- These need to be documented
- Multiple arguments can be documented in one place
@param x,y description
@examples
- Provides executable code on how to use the function in practice
- Must run without errors or use
\dontrun{}
- Keep in mind: Most users will look at examples first
@return
- Describes the output from the function.
- Addional tags
- Keep style conventions top of mind
- Check out the book for more details
ggplot2
example