[R] lower triangle of the correlation matrix with xtable

Steve_Friedman at nps.gov Steve_Friedman at nps.gov
Thu Sep 2 16:03:45 CEST 2010


try lower.tri

and see

??lower.tri

Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

Steve_Friedman at nps.gov
Office (305) 224 - 4282
Fax     (305) 224 - 4147


                                                                           
             Olga Lyashevska                                               
             <olga at herenstraat                                             
             .nl>                                                       To 
             Sent by:                  R mailing list                      
             r-help-bounces at r-         <r-help at r-project.org>              
             project.org                                                cc 
                                                                           
                                                                   Subject 
             09/02/2010 09:51          [R] lower triangle of the           
             AM                        correlation matrix with xtable      
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Dear all,

mydata<-data.frame(x1=c(1,4,6),x2=c(3,1,2),x3=c(2,1,3))
cor(mydata)
           x1         x2        x3
x1  1.0000000 -0.5960396 0.3973597
x2 -0.5960396  1.0000000 0.5000000
x3  0.3973597  0.5000000 1.0000000

I wonder if it is possible to fill only lower triangle of this
correlation matrix? Using 'dist' doesn't seem to be useful as it doesnt
allow to convert this table with xtable.

print(xtable(cor(mydata),digits=3))

Any ideas?
Cheers,
Olga

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



More information about the R-help mailing list