--- title: "Using envDocument" author: "Donald Jackson (donald.jackson@bms.com)" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Using envDocument} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- The `envDocument` package provides a function `env_doc()` which collects information about the environment in which an analysis is run. Currently, this includes: + R version + Attached packages with version and repository + General system information including OS and user + Script information including working directory. script path and modification time + Git commit information for script including tracking status, commit status, and remote (if git2r is available) The primary purpose is to capture information for inclusion in an analysis report. As such, the call to env_doc() should be made after all libraries are attached. Some functions, especialy `getScriptPath()` (get path to calling script) and `getRepo()` (find git repo for calling script), may be useful in other settings. Note: if the calling script is not tracked in a git repository then `env_doc()` or `getRepo()` will throw warnings. These can be disabled by setting `git = FALSE` (see examples). Version 2.3.1 adds support for Domino Datalab environment reporting. To add this, set `domino = TRUE` in the call to `env_doc()`. # Examples ```{r, echo = TRUE, eval = FALSE} library(envDocument) library(knitr) env_doc() # with git2r installed env_doc("table") # pretty-print output using knitr::kable env_doc(git = FALSE) # without git2r or if script is not trakced. env_doc(domino = TRUE) # optional - print information on Domino Datalab environment ``` The `getScriptPath()` function looks up the name of the script being run. If called in an interactive context it will return NA. `get_scriptpath()` is provided as an alias for backwards compatibility.