[R] Urgent Help with R calculation correlation coefficient

Peter Ehlers ehlers at ucalgary.ca
Mon Dec 6 11:30:12 CET 2010


On 2010-12-06 02:02, chintan85 wrote:
>
> 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..

If this is so urgent, then wouldn't it seem like a good idea to
actually peruse the help page for read.csv?

If you have a *tab*-delimited file, then why are your using
read.csv??

Try this:
1. read your data with read.table() or read.delim()
2. issue str(gse20437) to see what you've acutally read
3. Note that one of your columns is *not* numeric (as the
    very helpful error message is trying to tell you)

Peter Ehlers

>
> can anybody help me.
>
> thanks in advance
>
>
>
>



More information about the R-help mailing list