markvanderloo / lumberjack Goto Github PK
View Code? Open in Web Editor NEWTrack changes in data with ease
Track changes in data with ease
is it possible to use a differently named pipe instead of "%>>%" Pehaps "%>L>%"
Pipe "%>>%" is already being used by the package pipeR.
https://renkun.me/rlist-tutorial/Getting-started/Quick-overview.html
At the moment this is held back by a couple of issues: @example(s)
not working and @family
is ignored.
Use-case: Add username-column to log-rows to backtrack who made the changes.
Non-working solution, before dump_log():
transform( user = Sys.getenv("USERNAME")) %>>%
Results in all user-add-edits being logged, instead of username being added to existing rows in logs.
Better, but verbose solution:
After dump, read file back in, add column, write out again.
log_cellwise <- read.csv("log_cellwise.csv")
log_cellwise <- transform(log_cellwise, user = Sys.getenv("USERNAME"))
write.csv(log_cellwise, "log_cellwise.csv")
Are there some "Arguments passed to the dump method of the logger." that can be passed to achieve adding a column before the dump?
I would love if something like this was possible:
dump_log(data, "cellwise", file ="log.csv", cols = single_value/expression/transform() )
But I can see how it would open a can of worms potentially. Maybe there is some smart set of parameters / methods I am unaware of that could fit?
Using mutate during logging generates errors. For example, the following code generates the error:
Error in dump_log(., stop = TRUE, file = "train_log.csv") :
attempt to apply non-function
`
rm(list = ls())
train_data <- read.csv("train_original.csv",
header = TRUE,
stringsAsFactors = FALSE)
train_data <- train_data %>>%
mutate(id = seq(1, nrow(train_data), 1)) %>%
replace_with_na_all(condition = ~.x == "")
train_data <- train_data %>>%
as.data.frame() %>>%
start_log(log = cellwise$new(key = "id")) %>>%
mutate(MWC = character(length = nrow(train_data))) %>>%
impute_lm(Age ~ Fare + Pclass + Sex + Embarked) %>>%
dump_log(stop = TRUE, file = "train_log.csv")
train_data <- train_data %>>%
as.data.frame() %>>%
start_log(log = cellwise$new(key = "id")) %>>%
# mutate(MWC = character(length = nrow(train_data))) %>>%
impute_lm(Age ~ Fare + Pclass + Sex + Embarked) %>>%
dump_log(stop = TRUE, file = "train_log.csv")`
it's probably better that way..
Repro with the following example, the expression is broken down to 2 columns / shift the other columns to the right and makes the logs incorrect
data(women)
women$sleutel <- 1:nrow(women)
head(women)
women <- women %L>%
start_log(log=cellwise$new(key="sleutel")) %L>%
mutate( istall = ifelse(height>60, "Yes", "NO")) %L>%
dump_log(file=logfile, stop=TRUE)
head(women)
When an operation is performed that coerces the data into a tibble, the logging fails with errors. In the below example, the error is:
Error in
$<-.data.frame
(*tmp*
, value, value = c("1", "2", "3", "4", :
replacement has 10692 rows, data has 12
`
library(lumberjack)
rm(list = ls())
train_data <- read.csv("train_original.csv",
header = TRUE,
stringsAsFactors = FALSE)
train_data <- train_data %>>%
mutate(id = seq(1, nrow(train_data), 1)) %>%
replace_with_na_all(condition = ~.x == "")
train_data <- train_data %>>%
#as.data.frame() %>>%
start_log(log = cellwise$new(key = "id")) %>>%
impute_lm(Age ~ Fare + Pclass + Sex + Embarked) %>>%
dump_log(stop = TRUE, file = "train_log.csv")
train_data <- train_data %>>%
as.data.frame() %>>%
start_log(log = cellwise$new(key = "id")) %>>%
impute_lm(Age ~ Fare + Pclass + Sex + Embarked) %>>%
dump_log(stop = TRUE, file = "train_log.csv")`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.