filedump: The file dumping logger.

filedumpR Documentation

The file dumping logger.

Description

The file dumping logger dumps the most recent version of a dataset to csv in a directory of choice.

Format

An R6 class object.

Creating a logger

filedump$new(dir=file.path(tempdir(),"filedump"), filename="%sstep%03d.csv",verbose=TRUE)

dir [character] Directory location to write the file dumps.
filename [character] Template, used to create file names. to create a file name.
verbose [logical] toggle verbosity.

File locations are created with file.path(dir, file), where file is generated as sprintf(filename, DATA, STEP). In interactive sessions DATA="". In sessions where a script is executed using run_file, DATA is the name of the R object being tracked or the label provided with start_log. STEP is a counter that increases at each dump.

Dump options

$dump(...)

... Currently unused.

Retrieve log data

$logdata() returns a list of data frames, sorted in the order returned by base::dir()

Details

If dir does not exist it is created.

See Also

Other loggers: cellwise, expression_logger, no_log, simple

Examples

logger <- filedump$new()

out <- women %L>%
  start_log(logger) %L>%
  within(height <- height * 2) %L>%
  within(height <- height * 3) %L>%
  dump_log()
dir(file.path(tempdir(),"filedump"))



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