Re: [R] puzzled with plotmath for matrix indices

2011-01-20 Thread Claudia Beleites

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)


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

Anyways, I put the how to into the R Wiki page on plotmath.

And I suggest that it should be mentioned in the plotmath help = email to 
r-devel.

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.


Re: [R] puzzled with plotmath for matrix indices

2011-01-20 Thread Uwe Ligges



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.



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.


Best,
Uwe Ligges



Anyways, I put the how to into the R Wiki page on plotmath.

And I suggest that it should be mentioned in the plotmath help = email
to r-devel.

Claudia



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


Re: [R] puzzled with plotmath for matrix indices

2011-01-20 Thread Claudia Beleites

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,]13
[2,]24
 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.


Re: [R] puzzled with plotmath for matrix indices

2011-01-20 Thread Gerrit Eichner

Claudia,

Mittelhessen! ;-)


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)


Something is missing; this last sentence of yours appears to be not 
complete, does it?



Regarding Uwe's remark and Peter's nice aesthetic suggestion:


plot( 1, 1, xlab = substitute( Z[list(~i, j)], list( i = 1, j = 2)))


should solve both problems.

This does work even in R as old as 2.7.1 (and, of course, for a more 
recent version as Uwe already stated).


 Best regards / Beste Grüße  --  Gerrit__
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.