[R] multiple text placements and expressions revisited
Johannes Graumann
johannes_graumann at web.de
Thu Jan 17 10:21:27 CET 2008
Thanks for your help! Works like a charm now - I can even append to an
expression abject as if it was plain 'c()' ...
Joh
Prof Brian Ripley wrote:
> On Thu, 17 Jan 2008, Johannes Graumann wrote:
>
>> Hi all,
>>
>> I asked something like this earlier but decided that a proper minimal
>> example might be helpfull ;0)
>>
>> Why does this work with regards to the expression (substitution):
>>
>> require(stats)
>> plot(cars)
>> text(5,120,labels=substitute(i^{z+phantom()}*"("*a*"
>> AMU)",list(i="yx",z=2,a=0)))
>> text(c(5,5),c(115,110),labels=c("One","Two"))
>>
>> But adding this (using a vector of expressions/substitutions) fails to
>> print the expression correctly:
>>
>> text(c(5,5),c(105,100),labels=c(substitute(i^{z+phantom()}*"("*a*"
>> AMU)",list(i="yx",z=2,a=0)),"Three"))
>>
>> This is a bug, no?
>
> Yes, but not where you appear to think it is.
>
> 'labels' is not an expression: check it by typeof(). Using expression() in
> place of c() will give what I think you intended.
>
More information about the R-help
mailing list