On 01/20/2011 02:11 PM, Uwe Ligges wrote:


On 20.01.2011 14:08, Claudia Beleites wrote:
Gerrit,

thanks & viele Grüße nach Oberhessen :-)

plot (1, 1, ylab = expression (Z[list(i,i)]))
though that cannot be evaluated, either (due to [ not knowing what to do
with an index list)


Works for me with a recent R version.
Sorry, my comment wasn't clear: sure it produces the desired output, what I meant is:
> Z
     [,1] [,2]
[1,]    1    3
[2,]    2    4
> i <- 2
> eval (expression (Z[list(i,i)]))
Error in Z[list(i, i)] : invalid subscript type 'list'

whereas:
> eval (expression (Z[i,i]))
[1] 4

(and of course all the text-based solutions also lack the beauty of the expression actually meaning in R what the output looks like)

for future searches: probably the easiest cheat is, of course,
plot (1, 1, ylab = expression (Z["i, i"]))

which is less convenient since you could not replace i by a dynamically
calculated number, for example.
good point.

Thanks, I learn a lot here :-)

Claudia

--
Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Università degli Studi di Trieste
Via Alfonso Valerio 6/a
I-34127 Trieste

phone: +39 0 40 5 58-37 68
email: cbelei...@units.it

______________________________________________
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