Title: | Document the R Working Environment |
---|---|
Description: | Prints out information about the R working environment (system, R version,loaded and attached packages and versions) from a single function "env_doc()". Optionally adds information on git repository, tags, commits and remotes (if available). |
Authors: | Donald Jackson [aut, cre] |
Maintainer: | Donald Jackson <[email protected]> |
License: | GPL (>= 3.0) |
Version: | 2.4.1.9002 |
Built: | 2025-02-26 06:01:46 UTC |
Source: | https://github.com/dgjacks0n/envdocument |
Provides a function env_doc
that collects information on the
script, environment and system that performed an analysis.
Returns a data frame with information on:
- R version
- Attacheded packages and version
- OS, version and user
- Path and modification time of the calling script
- Git commit and tag info (optional, requires
git2r
)
Results are collected in a standardized data frame that can be queried or
pretty-printed using kable
or similar methods.
Maintainer: Donald Jackson [email protected]
Useful links:
env_doc
prints or returns a data frame with the following information:
- System version (OS, version, user, working directory)
env_doc(output = c("return", "print", "table"), system = TRUE, version = TRUE, packages = TRUE, script = TRUE, git = TRUE, domino = c("auto", "on", "off"))
env_doc(output = c("return", "print", "table"), system = TRUE, version = TRUE, packages = TRUE, script = TRUE, git = TRUE, domino = c("auto", "on", "off"))
output |
How should output be handled? Character, values: return - return as a data frame (default); print - print to stdout; table - pretty-print using knitr::kable (requires package knitr) |
system |
Include OS info from |
version |
Include R version from |
packages |
Include attached packages with repository and version from
|
script |
Include script path and modification time from
|
git |
Include git repository information from |
domino |
Include Domino Datalab run information from
|
- R version
- Package names and versions
- Top-level script name and modification time
- Git hash, status and tag (if any; requires package git2r)
If output = return (default): A data frame with columns for information type, variable name and value. NULL for output = print or output = table
env_doc("print") # print information to stdout info <- env_doc() # return information as a consolidated data frame
env_doc("print") # print information to stdout info <- env_doc() # return information as a consolidated data frame
Get information on R version
get_Rversion()
get_Rversion()
Rversion <- getRversion()
Rversion <- getRversion()
Get information about a Domino Datalab run from environment variables in the run environment
getDominoInfo(drop_vars = c("DOMINO_API_HOST", "DOMINO_EXECUTOR_HOSTNAME", "DOMINO_USER_API_KEY"))
getDominoInfo(drop_vars = c("DOMINO_API_HOST", "DOMINO_EXECUTOR_HOSTNAME", "DOMINO_USER_API_KEY"))
drop_vars |
Variables that will not be included in results. Character vector; see https://support.dominodatalab.com/hc/en-us/articles/205536355-Domino-environment-variables for a list of variables. |
data frame of Domino environment variables (renamed) and their values
getGitInfo
locates the git repository for the calling script
(if any) and retrieves relevant informaiton such as last commit, status
(e.g. modified since last commit) and tag (if any).
getGitInfo(scriptpath = NA)
getGitInfo(scriptpath = NA)
scriptpath |
Path to script (optional, defaults to calling script from get_scriptPath()) |
Requires that git2r
be installed.
git_info <- getGitInfo()
git_info <- getGitInfo()
getPackageInfo
returns information on attached packages
including name, version and source.
getPackageInfo()
getPackageInfo()
packages <- getPackageInfo()
packages <- getPackageInfo()
getRepo
looks the up the repository for a file and
makes sure path is tracked in repo. Repositories are searched
from the file directory up using
discover_repository
getRepo(testPath = NA)
getRepo(testPath = NA)
testPath |
Path to a file to find/check repo |
getScriptInfo
retrieves the file path and modification time
for the calling script.
getScriptInfo()
getScriptInfo()
Note: Currently this works if the script was called via source(), knitr::spin(), Rstudio's _compile notebook_ (ctrl-shift-K), Rscript or R -f.
script_info <- getScriptInfo()
script_info <- getScriptInfo()
getScriptPath
returns the full path of the script that called this function (if any)
or NULL if path is not available
getScriptPath(absolute = TRUE)
getScriptPath(absolute = TRUE)
absolute |
Return absolute path (absolute = TRUE, default) or path relative to working directory (FALSE) |
## Not run: mypath <- getScriptPath() ## End(Not run)
## Not run: mypath <- getScriptPath() ## End(Not run)
getSysInfo
returns the OS, hostname, userid and working directory
for the current analysis as a data frame
getSysInfo()
getSysInfo()
getSysInfo()
getSysInfo()
Return a consistent failure result when something is not available
infoNotFound()
infoNotFound()