expression_logger: The expression logger.

expression_loggerR Documentation

The expression logger.

Description

Records the result of one or more user-defined expressions that perform calculations on the object being tracked.

Format

An R6 class object.

Creating a logger

expression_logger$new(..., verbose=TRUE)

... A comma-separated list of name = expression pairs.
verbose [logical] toggle verbosity.

Each expression will be evaluated in the context of the object tracked with this logger. An expression is expected to have a single numeric or character output.

Dump options

$dump(file=NULL)

file [character] location to write final output to.

The default location is "expression.csv" in an interactive session, and "DATA_expression.csv" in a script that executed via run_file. Here, DATA is the variable name of the data being tracked or the label provided with start_log.

See Also

Other loggers: cellwise, filedump, no_log, simple

Examples


logfile <- file.path(tempfile(fileext=".csv"))
e <- expression_logger$new(mean=mean(height), sd=sd(height))

out <- women %L>%
  start_log(e) %L>%
  within(height <- height * 2) %L>%
  within(height <- height * 3) %L>%
  dump_log(file=logfile)

read.csv(logfile)



lumberjack documentation built on March 31, 2023, 7:56 p.m.