[R] In need of help with correlations

From: Sean Farris <farrissp2_at_vcu.edu>
Date: Sat, 09 Apr 2011 13:24:38 -0400


I am in need of someone's help in correlating gene expression. I'm somewhat new to R, and can't seem to find anyone local to help me with what I think is a simple problem.

I need to obtain pearson and spearman correlation coefficients, and corresponding p-values for all of the genes in my dataset that correlate to one specific gene of interest. I'm working with mouse Affymetrix Mouse 430 2.0 arrays, so I've got about 45,000 probesets (rows; with 1st column containing identifiers) and 30 biological replicates (columns; with the top row containing the header information).

I've looked through several Intro manuals and the R help files.

I know that "cor(x,y, use ="everything", method = c("pearson")) " can help obtain the coefficients.

I also know that "cor.test()" is supposed to test the significance of a single correlation coefficients.

I've also found the bioconductor package "genefilter" / "genefinder" that looks for correlations to a given gene (although I can't get it to work).

So far I've been able to:

#Read in the csv file

data<-read.csv("my data.csv")

#Check the dimensions, names, class, fix(data) to ensure the file was
loaded properly
dim(data)
names(data)
class(data)
fix(data)

#So far I've been able to successfully correlate the entire 'column' matrix
through:
x <- data[,2:30]
y <- data[,2:30]

corr.data<-cor(x,y, use = "everything", method = c("pearson"))

write.csv(corr.data, file = "correlation of my data by columns.csv")


Now if I try and run the 'cor.test()' function on the same matrix, I get and error message with 'x' must be a numeric vector. This I don't understand. And this is not my goal, but rather me trying to learn how to go about doing correlation analysis in R.

I've also tried transposing the data.frame using "as.data.frame(t(data))" and doing so gives the same error message as above.

Can anyone help me with figuring out how to conduct a correlation analysis for specific gene/probeset, and help me understand why I get the above error message? I know it probably is a simple analysis, that is probably just over my head right now since I'm still new to R. But I can't figure it out and have been trying with a bunch of different variations for the past week.

Thank you in advance for your help.

        [[alternative HTML version deleted]]



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. Received on Sat 09 Apr 2011 - 20:00:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 11 Apr 2011 - 07:50:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive