FAQ
Dear all,


I had to extracts/set elements from/in a matrix. Let say I have two
vectors dim1 and dim2 of indices in the respective two dimensions of a
matrix: I want to extract all the corresponding elements. I the case of a
nxn matrix, dim1 <- 1:n and dim2 <- 1:n would extract the diagonal.

I know one way would be to use the functions 'row' and 'col', but the
matrixes I have are can be rather large. This is probably a detail but
I was looking for something that would avoid be bit more memory
friendly... I have made functions for that purpose but I suspect somebody
already did something (which would be in R, but I could not find it...).
For the sake of avoiding duplication of similar things (hence making code
more readable), I would be happy to replace it in my code.

Does anybody knows if such things already exists ?


Laurent



Laurent Gautier CBS, Building 208, DTU
PhD. Student D-2800 Lyngby,Denmark
tel: +45 45 25 24 85 http://www.cbs.dtu.dk/laurent

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

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 4 | next ›
Discussion Overview
groupr-help @
categoriesr
postedDec 31, '01 at 1:28p
activeJan 2, '02 at 8:01a
posts4
users3
websiter-project.org
irc#r

People

Translate

site design / logo © 2017 Grokbase