G.
2007-Jul-20 00:21 UTC
[R] how to determine/assign a numeric vector to "Y" in the cor.test function for spearman's correlations?
Hello to all of you, R-expeRts! I am trying to compute the cor.test for a matrix that i labelled mydata according to mydata=read.csv... then I converted my csv file into a matrix with the mydata=as.matrix(mydata) NOW, I need to get the p-values from the correlations... I can successfully get the spearman's correlation matrix with: cor(mydata, method="s", use="pairwise,complete,obs") but then if I try the cor.test(mydata, method="s", use="pairwise.complete.obs") i always get an error message as follows: the "y" argument is missing and does not have any default value assigned... (excuse my translation) WHAT SHOULD I DO??? HOW CAN I DEFINE "Y" AS A NUMERIC VECTOR??????????? thanx guys, i just can't express myself as a computer would... G :) -- View this message in context: http://www.nabble.com/how-to-determine-assign-a-numeric-vector-to-%22Y%22-in-the-cor.test-function-for-spearman%27s-correlations--tf4114486.html#a11700314 Sent from the R help mailing list archive at Nabble.com.
Uwe Ligges
2007-Jul-20 11:01 UTC
[R] how to determine/assign a numeric vector to "Y" in the cor.test function for spearman's correlations?
G. wrote:> Hello to all of you, R-expeRts! > I am trying to compute the cor.test for a matrix that i labelled mydata > according to mydata=read.csv... > then I converted my csv file into a matrix with the > mydata=as.matrix(mydata) > NOW, I need to get the p-values from the correlations... > I can successfully get the spearman's correlation matrix with: > cor(mydata, method="s", use="pairwise,complete,obs") > but then if I try the > cor.test(mydata, method="s", use="pairwise.complete.obs") > i always get an error message as follows: > the "y" argument is missing and does not have any default value assigned... > (excuse my translation) > WHAT SHOULD I DO??? > HOW CAN I DEFINE "Y" AS A NUMERIC VECTOR??????????? > thanx guys, i just can't express myself as a computer would... > G :)You have to specify two vectors for the test, e.g.: cor.test(mydata[,1], mydata[,2], method = "s", use = "pairwise.complete.obs") See the help page ?cor.test Best, Uwe
Apparently Analagous Threads
- bug? in stats::cor for use=complete.obs with NAs
- Spearman's Rho Help!
- Wrong result with cor(x, y, method="spearman", use="complete.obs") with NA's???
- Incorrect matrix of spearman correlations .... in 64-bit Linux ... (PR#9568)
- cor.test(method = spearman, exact = TRUE) not exact (PR#14095)