Have you considered cor? The command
'help.search(correlation)' suggests among other functions
var(stats), the documentation for which also includes cor.
If this is not adequate, PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html . It may help you get
From the help for cor (from the stats package):
If x and y are matrices then the covariances (or correlations) between the
columns of x and the columns of y are computed.
So if you make a matrix with each column corresponding to one of your
variables, you can get what you're after.
For future
Le 07.02.2005 16:58, Jessica Higgs a écrit :
Hi all:
I have a question on how to go about creating a correlation matrix. I
have a huge amount of data21 variables for 3471 times. I want to
see how each of the variables correlate to each other. Any help would
be appreciated, including which
I've tried using cor() by the following sequence:
C - cor(x, y = NULL, use = all.obs, method = c(pearson))
where x is my matrix of 21 columns and 3471 rows.
and I get this error:
Error in cor(x, y = NULL, use = all.obs, method = c(pearson)) :
missing observations in cov/cor
any
Jessica Higgs wrote:
I've tried using cor() by the following sequence:
C - cor(x, y = NULL, use = all.obs, method = c(pearson))
where x is my matrix of 21 columns and 3471 rows.
and I get this error:
Error in cor(x, y = NULL, use = all.obs, method = c(pearson)) :
missing observations in
Le 07.02.2005 18:53, Jessica Higgs a écrit :
I've tried using cor() by the following sequence:
C - cor(x, y = NULL, use = all.obs, method = c(pearson))
In ?cor you find that :
If 'use' is 'all.obs', then the presence of missing observations will
produce an error.
try use=complete instead.
, February 07, 2005 12:54 PM
To: Spencer Graves; R-help@stat.math.ethz.ch
Subject: Re: [R] Creating a correlation Matrix
I've tried using cor() by the following sequence:
C - cor(x, y = NULL, use = all.obs, method = c(pearson))
where x is my matrix of 21 columns and 3471 rows.
and I get this error