Skip to content

Instantly share code, notes, and snippets.

@MCMaurer
Last active May 25, 2021 20:29
Show Gist options
  • Save MCMaurer/37d6b4bfaf8cd23009a55d2d52ea1638 to your computer and use it in GitHub Desktop.
Save MCMaurer/37d6b4bfaf8cd23009a55d2d52ea1638 to your computer and use it in GitHub Desktop.
a demonstration of some of the crazy stuff you can do renaming functions in R
attach(list(
`+` = function(a, b){
noquote(paste0(sum(a,b,rnorm(1,0,0.0001)), "ish"))
},
`(` = function(a){
a*rnorm(1,1,0.001)
},
`<-` = function(a,b){
warning("lol nah")
},
`/` = function(a,b){
warning("divided we fall, truly words to live by")
},
library = function(package){
warning("You have several overdue books and your library card has been revoked. Follow this link to reactivate: https://bit.ly/34hKSpu")
},
`==` = function(a,b){
message("They look pretty close to me")
}
), name = "JokeFunctions", warn.conflicts = FALSE)
(2)
x <- 3
2 + 2
4 / 5
library(tidyverse)
4 == 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment