overwrite {admisc} | R Documentation |
Overwrite an object in a given environment.
Description
Utility function to overwrite an object, and bypass the assignment operator.
Usage
overwrite(objname, content, environment)
Arguments
objname |
Character, the name of the object to overwrite. |
content |
An R object |
environment |
The environment where to perform the overwrite procedure. |
Value
This function does not return anything.
Author(s)
Adrian Dusa
Examples
foo <- function(object, x) {
objname <- deparse(substitute(object))
object <- x
overwrite(objname, object, parent.frame())
}
bar <- 1
foo(bar, 2)
bar
# [1] 2
bar <- list(A = bar)
foo(bar$A, 3)
bar
[Package admisc version 0.35 Index]