capture_environment: Capture the Analysis Environment for a Manifest

View source: R/lib_capsule.R

capture_environmentR Documentation

Capture the Analysis Environment for a Manifest

Description

Records the facts a replicator needs to rebuild the session: R version, platform, operating system, a UTC timestamp, and the versions of the requested packages.

Usage

capture_environment(packages = loadedNamespaces())

Arguments

packages

Character vector of package names to record. Defaults to every currently loaded namespace.

Value

A list with r_version, platform, os, captured_utc, and packages (a named character vector of versions).

Examples

# Record specific packages' versions alongside the session facts.
env <- capture_environment(c("stats", "utils"))
env$r_version
env$os
env$packages          # named character vector of versions

# Default captures every currently loaded namespace.
names(capture_environment())[1:4]

rmoriebricklayer documentation built on Aug. 5, 2026, 9:08 a.m.