Write Printed Output of R Objects to Log Files

Provides writeLog(), a small helper that writes the printed output of a named list of R objects to a text file in a log directory, one element after another, each preceded by its list name as a heading. Supports versioned file names and appending to an existing log file.


writeLog

An R package providing writeLog(), a helper that writes the printed output of a named list of R objects to a .txt file in a log directory, one element after another, each preceded by its list name as a heading.

Installation

# install.packages("devtools")
devtools::install_github("jeffzifanwu/writeLog")

Usage

library(writeLog)

writeLog(
  list(contents1 = summary(1:10), contents2 = mean(1:10)),
  fileName = "allContents",
  version  = "v1",
  desc     = "All contents",
  logDir   = "log"
)

This writes log/v1_allContents.txt, with each list element preceded by its name (or a positional heading like [[2]] for unnamed elements). Pass append = TRUE to add to an existing log file instead of overwriting it.

Development

devtools::document()
devtools::test()
devtools::check()

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("writeLog")

0.1.0 by Jeffzifan Wu, 12 hours ago


https://github.com/jeffzifanwu/writeLog


Report a bug at https://github.com/jeffzifanwu/writeLog/issues


Browse source code at https://github.com/cran/writeLog


Authors: Jeffzifan Wu [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Suggests testthat, withr


See at CRAN