[R] Substitute in legend

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sat Aug 23 00:14:14 CEST 2003


Deepayan Sarkar <deepayan at stat.wisc.edu> writes:

> > legend(1,0.5,as.expression(substitute(hat(theta) == p, list(p = pval))))
> 
> Just out of curiosity: ?legend says 
> 
>   legend: a vector of text values or an 'expression' of length >= 1 to
>           appear in the legend.
> 
> Is an object of mode "call" either ? (is.expression() returns FALSE.) Are they 
> expected to work wherever expressions are supposed to work ?

No, yes. They're not text nor expressions (so technically there's no
bug), but it is easier to construct them with substitute() and they do
generally work like expressions of length 1 in graphs.

-- 
   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




More information about the R-help mailing list