Uwe Ligges wrote:

> 
> 
> Johannes Graumann wrote:
>> Hi all,
>> 
>> I'm trying to use an iteration that appends something to vector
>> 'peaklabels' like so:
>> peaklabelNames <- append(
>>         peaklabelNames,
>>         substitute(i^{z+phantom()}*" ("*a*"AMU)",list(i="y2",z=2,a=0))
>> )
>> The vector is supposed to be used with 'text' to put labels on signals in
>> an impulse plot.
>> 
>> While not vectorized
>>         substitute(i^{z+phantom()}*" ("*a*"AMU)",list(i="y2",z=2,a=0))
>> works for me, the vectorized form doesn't. The labels are represented as
>>         "y2"^2 (AMU)
>> (note the '"' in the printed string). Can anyone please give me a hint on
>> how to resolve this?
> 
> 
> I do not know what you mean by vectorized form. Can you give an example
> what you want to achieve and what you tried to do so?

Thanks for looking at this.

The actual code looks something like this:

peaklabelNames <- c()
for(i in sequence(10)){
        peaklabelNames <- append(
                peaklabelNames,
                substitute(i^{z+phantom()}*" ("*a*"AMU)",list(i="y2",z=2,a=0))
        )
}

and is than used after 'plot' as

text(somex,somey,labels=peaklabelNames)

That doesn't work as described above.

Thanks for your time, Joh

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to