[R] substitute/paste question for using Greek in plot titles

Peter Dunn dunn at usq.edu.au
Thu Nov 11 01:25:27 CET 2004


Hi all

I am having troubles making sense of why code (1)
below fails but code (2) below works.

Code (1):

 > phi.1 <- 1
 > plot(0 ~ 0,
+ main=substitute(paste("A vaue for ",phi," = ",phival), 
list(phival=phi.1)) )

Error in paste("The two deviances for ", phi, " = ", 2) :
         Object "phi" not found

But this works:

Code (2):
 > plot(0,0,
+ main=substitute(paste("A value for ",phi," = ",phival), 
list(phival=phi.1)) )
 >

It appears that if the plot command takes the formula style entry,
the substitue/paste fails.

Is this documented as a feature (I couldn't find it if that is the
case), or is it a bug?  If it is a feature, it is a subtle difference
between (1) and (2) that has potential to be quite frustrating!

Perhaps I should just upgrade to version 2.0.0, though I can't see
anything in the Release Notes that might cause this.

Thanks.

P.

 > version
          _
platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    1
minor    9.1
year     2004
month    06
day      21
language R




-- 
Dr Peter Dunn          (USQ CRICOS No. 00244B)
   Web:    http://www.sci.usq.edu.au/staff/dunn
   Email:  dunn @ usq.edu.au
Opinions expressed are mine, not those of USQ.  Obviously...




More information about the R-help mailing list