[R] RES: How to store a triangular matrix
Filipe Leme Botelho
filipe.botelho at vpar.com.br
Fri May 13 19:33:51 CEST 2011
Estefania, if you do something like
your.matrix <- matrix(1, 50, 50)
your.matrix[upper.tri(your.matrix)] <- NA
You will have NAs for the entire upper triangle. If you opt to do
your.matrix[upper.tri(your.matrix)] <- ""
The upper triangle will be empty but it will coerce data to be 'character' instead of 'numeric'. Hope it helps.
-----Mensagem original-----
De: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Em nome de Estefania Ruiz Vargas
Enviada em: sexta-feira, 13 de maio de 2011 11:53
Para: r-help at r-project.org
Assunto: [R] How to store a triangular matrix
Hello, I want to create a triangular matrix and only keep the lower triangle entries without having to allocate memory for the whole matrix, is there any way I can do something like A<-matrix(data, nrow=50)
but for a triangular matrix?
Thanks
ERV
[[alternative HTML version deleted]]
"This message and its attachments may contain confidential and/or privileged information. If you are not the addressee, please, advise the sender immediately by replying to the e-mail and delete this message."
"Este mensaje y sus anexos pueden contener información confidencial o privilegiada. Si ha recibido este e-mail por error por favor bórrelo y envíe un mensaje al remitente."
"Esta mensagem e seus anexos podem conter informação confidencial ou privilegiada. Caso não seja o destinatário, solicitamos a imediata notificação ao remetente e exclusão da mensagem."
More information about the R-help
mailing list