partha_bagchi at hgsi.com writes:
> I tried to use substitute in legend as follows:
> 
> pval <- 0.04
> plot(0)
> legend(1,0.5,substitute(hat(theta) == p, list(p = pval)))
> 
> For some reason the legend is repeated 3 times. 
> 
> Any suggestions or is this a bug?
It's a bug. The code is looking at length(legend), but that is not the
number of legends when mode "call" objects are concerned. A workaround
is 
legend(1,0.5,as.expression(substitute(hat(theta) == p, list(p = pval))))
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907