The not-a-pipe operator that logs
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
pkg
.gitignore
.travis.yml
README.md
build.sh
document.sh
test.r

README.md

lumberjack -- the pipe operator that logs

Build Status Coverage Status CRAN DownloadsMentioned in Awesome Official Statistics

A function composition operator ('pipe') and extensible framework that allows for easy logging of changes in data.

Installation

install.packages('lumberjack')

Usage

To log changes in data, you need to attach a logger, and use the lumberjack operator %>>%.

> out <- iris %L>%     # feed iris
+   start_log() %L>%   # tag for logging
+   identity() %L>%    # do nothing
+   head() %L>%        # cut of the head
+   dump_log()         # dump log
Dumped a log at /home/mark/projects/lumberjack/simple_log.csv
> 
> # the processed data is here:
> 
> out[1:3]
  Sepal.Length Sepal.Width Petal.Length
1          5.1         3.5          1.4
2          4.9         3.0          1.4
3          4.7         3.2          1.3
4          4.6         3.1          1.5
5          5.0         3.6          1.4
6          5.4         3.9          1.7
> 
> # the log is here:
> read.csv("simple_log.csv")
  step                time expression changed
1    1 2017-06-01 12:08:03 identity()   FALSE
2    2 2017-06-01 12:08:03     head()    TRUE

The start_log function takes as its argument a logging object, which is a Reference or a R6 class implementing two methods: $add and $dump. Other than that it is completely flexible and users can write their own loggers as desired.

Materials