I've got a covariance matrix that I'd like to index using the dimnames:> vcov1n0 x0 s n1 n2 n0 82.43824759 1.839505e-02 -4.975196e-01 2.882394e+03 -2.615986e-01 x0 0.01839505 6.134010e-03 -7.695922e-04 -6.373946e+01 6.086321e-03 s -0.49751964 -7.695922e-04 9.638943e-03 3.406594e+02 -3.173671e-02 n1 2882.39407745 -6.373946e+01 3.406594e+02 1.036195e+08 -9.361243e+03 n2 -0.26159863 6.086321e-03 -3.173671e-02 -9.361243e+03 8.506608e-01 I'd like to select particular elements by name, rather than numeric index. For example, vcov1[1,1] returns 82.43824759. Is there a way to use the dimnames to extract the n0,n0 element? Thanks, Mike -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On 7 Aug 2002, Michael A. Miller wrote:> I've got a covariance matrix that I'd like to index using the > dimnames: > > > vcov1 > n0 x0 s n1 n2 > n0 82.43824759 1.839505e-02 -4.975196e-01 2.882394e+03 -2.615986e-01 > x0 0.01839505 6.134010e-03 -7.695922e-04 -6.373946e+01 6.086321e-03 > s -0.49751964 -7.695922e-04 9.638943e-03 3.406594e+02 -3.173671e-02 > n1 2882.39407745 -6.373946e+01 3.406594e+02 1.036195e+08 -9.361243e+03 > n2 -0.26159863 6.086321e-03 -3.173671e-02 -9.361243e+03 8.506608e-01 > > I'd like to select particular elements by name, rather than > numeric index. For example, vcov1[1,1] returns 82.43824759. Is > there a way to use the dimnames to extract the n0,n0 element? >The obvious thing to try is vcov1["n0","n0"], which works. -thomas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> "Thomas" == Thomas Lumley <tlumley at u.washington.edu> writes:> The obvious thing to try is vcov1["n0","n0"], which works. Thanks! -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._