[R] Please help on correlation matrix

Gabor Grothendieck ggrothendieck at gmail.com
Sat Mar 25 14:05:51 CET 2006


This works as long as you have no more than 26 variables.
Suppose your correlation matrix is x.

x <- cor(iris[,-5])  # test data
rownames(x) <- colnames(x) <- letters[1:ncol(x)]

On 3/25/06, stat stat <stat700004 at yahoo.co.in> wrote:
> hi everyone,
>
>  Suppose I have three variables a, b, and c each with 10 values. Now I construct a corr matrix for them. Now I want to give the names of columns of corr matrix as a, b, c, i.e. the first column of corr matrix will have name as 'a' second column with 'b' and so on. Can anyone give me any code by which I can automatically assign the names of columns of corr matrix which are originally the names of variables?
>
>  For example suppose next we have 5 variables r1….r5. I want to see the names of columns of corr matrix as r1………….r5.
>
>  Thanks in advance
>
>
> ---------------------------------
>
>
>        [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>




More information about the R-help mailing list