[R] How to define a function (with '<-') that has two arguments?

Peter Dalgaard pdalgd at gmail.com
Wed Jul 14 10:35:00 CEST 2010


thmsfuller066 at gmail.com wrote:
> Hi All,
> 
> The last line if the following code returns the error right below this
> paragraph. Essentially, I use the operator %:% to retrieve a variable
> in a nested frame. Then I want to use the same operator (with '<-') to
> change its value.  I'm not sure if this is possible in R with %:%
> operator. Would you please help and let me how to correct the code if
> it is possible?
> 
> Error in `%:%<-`(`*tmp*`, a, value = 2) : unused argument(s) (value = 2)

I'm fairly sure I'd not want to take that route, but the direct cause of
the error is that the value argument to an assignment function must be
called "value", not "z". Beware though, that the code may still not do
what you think it should do (e.g., the return value for an assignment
function REPLACES the first argument).


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list