Skip to content

Instantly share code, notes, and snippets.

@krlmlr
Created June 10, 2021 03:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save krlmlr/5ca4197116b83fb08fcc723b9cfe9a6b to your computer and use it in GitHub Desktop.
Save krlmlr/5ca4197116b83fb08fcc723b9cfe9a6b 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