Assignment in environment
On So, Feb 7, 2016 at 2:46 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
An assignment function should return the modified value. So it looks
like you would need
'getValue<-' <- function(x, value) {
environment(x)$mylist <- value
x
}
Thanks. I have not thought of a return value. That makes the difference.
but in fact, this doesn't work: getValue(fn)[[1]] <- 3 Error in getValue(fn)[[1]] <- 3 : could not find function "getValue"
I have a "getValue" function anyway. It was even the other way round. I wanted to assign values without a function "getValue<-" and was rebuked by R that this function was missing. Thanks to both of you, Peter and Duncan. Best regards, Daniel