Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Probably the most malicious thing I've done with R
# operator that reverses the direction of assignment
# only if called from the global environment
`%>>%` <- function(x,y) {
if(sys.nframe() == 1) {
assign(deparse(substitute(y)), x, parent.frame())
} else {
assign(deparse(substitute(x)), y, parent.frame())
}
}
# redefine the assigment operator and cover our
# tracks just to make it as nasty as possible
unlockBinding("<-", baseenv())
`<-` <<- `%>>%`
rm(`%>>%`)
lockBinding("<-", baseenv())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.