Documentation can have code that is run dynamically either at install, build or render time: https://cran.r-project.org/doc/manuals/R-exts.html#Dynamic-pages