Skip to content

Instantly share code, notes, and snippets.

View k8hertweck's full-sized avatar

Kate Hertweck k8hertweck

View GitHub Profile
@thebioengineer
thebioengineer / delayed_evaluation_in_pipes.R
Last active May 23, 2019 19:42
Testing delayed evaluation in pipes
`%>>>%`<-function(lhs,rhs){
parent <- parent.frame()
env <- new.env(parent = parent)
chain_parts <- magrittr:::split_chain(match.call(), env = env)
eval(as.call(call("%>%",call("%>%",chain_parts$lhs$lhs,substitute(play)),chain_parts$lhs$rhs)))
}
play<-function(lhs){
delayedexpr<-as.list(attr(lhs,"delayedeval"))
delayedFunc<-delayedexpr[[length(delayedexpr)]]