[R] Convert back to lower triangular matrix

Bert Gunter gunter.berton at gene.com
Tue Nov 15 23:59:24 CET 2011


1. Please post in plain text, not HTML (as the posting guide asks!)

2. This might actually be an R question -- is
?lower.tri
what you want?

-- Bert

On Tue, Nov 15, 2011 at 2:50 PM, Jeff Newmiller
<jdnewmil at dcn.davis.ca.us> wrote:
> This is R-help, not the linear algebra hotline. Please stay on topic.
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                      Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> Juliet Ndukum <jpntsang at yahoo.com> wrote:
>
>>Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0
>>The euclidean distance between the vector elements is given by the
>>lower triangular matrix�> dd1 = dist(ab,"euclidean")> dd1� � 1 � 2 � 3
>>� 4 � 52 0.1 � � � � � � � �3 0.2 0.1 � � � � � �4 0.3 0.2 0.1 � � � �5
>>0.4 0.3 0.2 0.1 � �6 0.5 0.4 0.3 0.2 0.1
>>Convert the lower triangular matrix to a full matrix> ddm =
>>as.matrix(dd1)> ddm� � 1 � 2 � 3 � 4 � 5 � 61 0.0 0.1 0.2 0.3 0.4 0.52
>>0.1 0.0 0.1 0.2 0.3 0.43 0.2 0.1 0.0 0.1 0.2 0.34 0.3 0.2 0.1 0.0 0.1
>>0.25 0.4 0.3 0.2 0.1 0.0 0.16 0.5 0.4 0.3 0.2 0.1 0.0
>>I would be grateful if someone could provide me with a code to convert
>>ddm to the lower triangular matrix as before i.e. dd1
>> above.
>>Your help will be greatly appreciated.JN
>>       [[alternative HTML version deleted]]
>>
>>______________________________________________
>>R-help at r-project.org 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.
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list