Package 'envDocument'

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

Help Index


Document the environment under which an analysis was performed

Description

Provides a function env_doc that collects information on the script, environment and system that performed an analysis.

Details

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.

Author(s)

Maintainer: Donald Jackson [email protected]

See Also

Useful links:


Report the working environment in which an analysis was performed.

Description

env_doc prints or returns a data frame with the following information: - System version (OS, version, user, working directory)

Usage

env_doc(output = c("return", "print", "table"), system = TRUE,
  version = TRUE, packages = TRUE, script = TRUE, git = TRUE,
  domino = c("auto", "on", "off"))

Arguments

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 getSysInfo? Boolean, default TRUE

version

Include R version from getRversion? Boolean, default TRUE

packages

Include attached packages with repository and version from getPackageInfo? Boolean, default TRUE

script

Include script path and modification time from getScriptInfo? Boolean, default TRUE

git

Include git repository information from getGitInfo (note: requires git2r)? Boolean, default TRUE

domino

Include Domino Datalab run information from getDominoInfo? Character, values: auto - include if available; on - include with warning if not available; off - do not include evn if available

Details

- R version

- Package names and versions

- Top-level script name and modification time

- Git hash, status and tag (if any; requires package git2r)

Value

If output = return (default): A data frame with columns for information type, variable name and value. NULL for output = print or output = table

Examples

env_doc("print") # print information to stdout
 info <- env_doc() # return information as a consolidated data frame

Get information on R version

Description

Get information on R version

Usage

get_Rversion()

Examples

Rversion <- getRversion()

Get information about a Domino Datalab run from environment variables in the run environment

Description

Get information about a Domino Datalab run from environment variables in the run environment

Usage

getDominoInfo(drop_vars = c("DOMINO_API_HOST",
  "DOMINO_EXECUTOR_HOSTNAME", "DOMINO_USER_API_KEY"))

Arguments

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.

Value

data frame of Domino environment variables (renamed) and their values


Get git repository information for a script

Description

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).

Usage

getGitInfo(scriptpath = NA)

Arguments

scriptpath

Path to script (optional, defaults to calling script from get_scriptPath())

Details

Requires that git2r be installed.

Examples

git_info <- getGitInfo()

Get information on attached packages

Description

getPackageInfo returns information on attached packages including name, version and source.

Usage

getPackageInfo()

Examples

packages <- getPackageInfo()

Locate the git repository where a file is tracked

Description

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

Usage

getRepo(testPath = NA)

Arguments

testPath

Path to a file to find/check repo


Get information about the calling script

Description

getScriptInfo retrieves the file path and modification time for the calling script.

Usage

getScriptInfo()

Details

Note: Currently this works if the script was called via source(), knitr::spin(), Rstudio's _compile notebook_ (ctrl-shift-K), Rscript or R -f.

Examples

script_info <- getScriptInfo()

Get the path of the calling script

Description

getScriptPath returns the full path of the script that called this function (if any) or NULL if path is not available

Usage

getScriptPath(absolute = TRUE)

Arguments

absolute

Return absolute path (absolute = TRUE, default) or path relative to working directory (FALSE)

Examples

## Not run:  
mypath <- getScriptPath() 

## End(Not run)

Get system information.

Description

getSysInfo returns the OS, hostname, userid and working directory for the current analysis as a data frame

Usage

getSysInfo()

Examples

getSysInfo()

Return a consistent failure result when something is not available

Description

Return a consistent failure result when something is not available

Usage

infoNotFound()