[R-sig-eco] How to change a coefficient matrix into a semi-matrix?

Gavin Simpson gavin.simpson at ucl.ac.uk
Sun Aug 30 17:03:00 CEST 2009


On Sun, 2009-08-30 at 22:26 +0800, Zongshan, Li wrote:
> Dear all of r-sig-ecology:
> 
> I have a coefficient matrix produced by Phylocom, for example:
>       plot1       plot2       plot3       plot4       plot5
> plot1       245.76    258.94    252.88    254.23    249.19 
> plot2       258.94    269.58    264.39    265.55    261.85 
> plot3       252.88    264.39    259.87    260.42    256.30 
> plot4       254.23    265.55    260.42    262.75    257.44 
> plot5       249.19    261.85    256.30    257.44    254.01
> I want to do the hierarchical cluster analysis in R with the funtion:
> hclust, but the format of input data of hclust is semi-matrix, for
> example:
>       plot1       plot2       plot3       plot4
> plot2       258.94                  
> plot3       252.88    264.39           
> plot4       254.23    265.55    260.42    
> plot5       249.19    261.85    256.30    257.44
>  
> Is there some function in R to change a matrix into the format of
> semi-matrix?

See as.dist? to go from the full matrix format to an object of class
'dist' as required by hclust.

HTH

G

> Thanks a lot! Best regards to all of you! 
> 
> 
> Zongshan, Lizsli_st at rcees.ac.cn
> 2009-08-30 
> 
> -------------------
> Zongshan, Li
> Research Center for Eco-Environmental Sciences, Chinese Academy of Science
> P. O. Box 2871
> 18 Shuangqing Road, Haidian District, Beijing, 100085
> Peoples Republic of China
> Tel:0086-10-13699145748
> Fax:0086-10-62923549
> Email:zsli_st at rcees.ac.cn
>  
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-sig-ecology mailing list