Erin Hodgess <[EMAIL PROTECTED]> writes:

> a <- 0.5*(outer(1:n3,1:n3,function(x,y,n2.=n2){n2. - pmax(x,y)}))
> Why doesn't this work please?

Because defaults are expressions to be evaluated in the function's
evaluation frame (i.e. the expression could depend on x and y for
instance). When you evaluate the function, it goes looking for n2 --
and you're back to square one, basically. You might use substitute to
poke a precomputed n2 into the function definition, but it isn't
pretty.  

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

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

Reply via email to