Hi again everybody.

Yesterday I had a problem with c-style "+=" functions.  One suggestion
was to define

R> "plus<-" <- function(x,value){x+value}

Then

R> a <- matrix(1:9,3,3)
R> plus(a[a%%2==1]) <- 1000

works as desired.


QUESTION: why does this behave differently:



R> "plus<-" <- function(x,y){x+y} R> a <- matrix(1:9,3,3)

R> plus(a[a%%2==1]) <- 1000
Error in "plus<-"(`*tmp*`, value = 1000) :
        unused argument(s) (value ...)
R>

The only change seems to be changing the second argument from "value"
to "y".  Why does this affect anything?  Where do I look for
documentation on things like "plus<-"  ?

--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
SO14 3ZH
tel +44(0)23-8059-7743
[EMAIL PROTECTED] (edit in obvious way; spam precaution)

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to