Skip to contents

Parses a structured session log created by start_session_logger() (or a plain .Rhistory file) and writes two files into output_dir:

Usage

summarize_r_session(
  log_file = NULL,
  rhistory = NULL,
  output_dir = NULL,
  open = TRUE
)

Arguments

log_file

Character or NULL. Path to a .log file written by start_session_logger(). When NULL (default) the most recent log in ~/.R/session_logs/ is used.

rhistory

Character or NULL. Path to an .Rhistory file to summarize instead of a structured log. Takes precedence over log_file.

output_dir

Character or NULL. Directory for the output files. Defaults to the directory containing log_file (or rhistory), or the current working directory.

open

Logical. If TRUE (default) and the session is interactive, opens the markdown file in the editor after writing.

Value

Invisibly returns a named list with $md, $r, and $data.

Details

  • session_YYYYMMDD_summary.md - a markdown report with phase-by-phase summaries, error counts, and a plot inventory.

  • session_YYYYMMDD_clean.R - a deduplicated, phase-annotated R script containing only the successful commands.