Skip to content
Prev 247853 / 398503 Next

puzzled with plotmath for matrix indices

On 01/20/2011 02:11 PM, Uwe Ligges wrote:
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)
good point.

Thanks, I learn a lot here :-)

Claudia