Last active
December 11, 2015 02:39
-
-
Save ramnathv/4532561 to your computer and use it in GitHub Desktop.
Wrap Hook Results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Wrap output of a function | |
#' | |
#' This function can be used to redefine output hooks easily for some important | |
#' use cases | |
wrap <- function(fn, before, after){ | |
function(x, ...){ | |
x = paste(c(before, x, after), collapse = '\n') | |
fn(x, ...) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment