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: [email protected] [mailto:[email protected]] Em nome
de Estefania Ruiz Vargas
Enviada em: sexta-feira, 13 de maio de 2011 11:53
Para: [email protected]
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."
______________________________________________
[email protected] 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.