Skip to content

Instantly share code, notes, and snippets.

@sbalci
Forked from krlmlr/block.R
Created June 10, 2021 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbalci/f96af73bb9a0073b365b47fb056d66f3 to your computer and use it in GitHub Desktop.
Save sbalci/f96af73bb9a0073b365b47fb056d66f3 to your computer and use it in GitHub Desktop.
Block assigning to a variable more than once
`<-` <- function(lhs, rhs, envir = parent.frame()) {
assign(as.character(substitute(lhs)), rhs, envir)
lockBinding(substitute(lhs), envir)
invisible(rhs)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment