Odp: Urgent Help with R calculation correlation coefficient
On Dec 6, 2010, at 11:28 , Petr PIKAL wrote:
Hi r-help-bounces at r-project.org napsal dne 06.12.2010 11:02:03:
Hi, I am trying to calculate correlation coefficient for gene expression
data.
Tab delimited file looks like this
Id v1 v2 v3
df 56 90 45
gh 87 98 78
ty 89 78 67
I used this code
[code]
gse20437 <- read.csv("C:/Users//Desktop/data/GSE20437_matrix.txt",header
=
TRUE, sep = ",", strip.white = TRUE) gsecor <- cor(gse20437, method ="pearson") or gsecor <- cor(gse20437) [/code] i get error x must be numeric.. can anybody help me.
At least your Id column is not numeric. Do not use it for cor. gsecor <- cor(gse20437[,-1])
Also, using sep="," for a TAB delimited file is suspect (to say the least). (Note, by the way read.delim())
Peter Dalgaard Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com