start_log: Start tracking an R object

View source: R/lumberjack.R

start_logR Documentation

Start tracking an R object

Description

Start tracking an R object

Usage

start_log(data, logger = simple$new(), label = NULL)

Arguments

data

An R object.

logger

A logging object (typically an environment wrapped in an S3 class)

label

[character] scalar. A label to attach to the logger (for loggers supporting it).

Details

All loggers that come with lumberjack support labeling. The label is used by dump methods to create a unique file name for each object/logger combination.

If label is not supplied, start_log attempts to create a label from the name of the data variable. This probably fails when data is not a variable but an expression (like read.csv...). A label is also not created when data is passed via the lumberjack not-a-pipe operator. In that case the label is (silently) not set. In cases where multiple datasets are logged with the same type of logger, this could lead to overwriting of dump files, unless file is explicitly defined when calling dump_log.

See Also

Other control: %>>%(), dump_log(), get_log(), run_file(), stop_log()

Examples

logfile <- tempfile(fileext=".csv")
women %L>%
  start_log(logger=simple$new()) %L>%
  transform(height_cm = height*2.52) %L>%
  dump_log(file=logfile)
logdata <- read.csv(logfile)
head(logdata)


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