From daniel.kaschek at physik.uni-freiburg.de  Sun Feb  7 17:44:27 2016
From: daniel.kaschek at physik.uni-freiburg.de (Daniel Kaschek)
Date: Sun, 07 Feb 2016 17:44:27 +0100
Subject: [Rd] Assignment in environment
In-Reply-To: <56B74AC7.4010901@gmail.com>
References: <1454850489.16166.0@physik.uni-freiburg.de>
	<56B74AC7.4010901@gmail.com>
Message-ID: <1454863467.16166.1@physik.uni-freiburg.de>

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



[Rd] Assignment in environment
Daniel Kaschek