[R] How to calculate fold change and its confidence interval
Steve Lianoglou
mailinglist.honeypot at gmail.com
Wed Mar 31 06:24:10 CEST 2010
Hi,
Firstly, you should bring your bioinformatics related questions over
to the bioconductor mailing list. Please sign up and post that portion
there, see:
http://www.bioconductor.org/docs/mailList.html
But, getting to your last question:
>> fc.perSample <- cbind(tb[,1]/tb[,3], tb[,2]/tb[,4])
>> fc.perSample
> [,1] [,2]
> [1,] 2.471264 1.1666667
> [2,] 2.475610 0.7045455
> [3,] 2.469565 1.6111111
> [4,] 2.421053 0.7529412
>
>> rowMeans(fc.perSample)
> [1] 1.818966 1.590078 2.040338 1.586997
>
> But if you manually check every gene one by one, totally different results
> were got. for example:
>> mean(2.471264, 1.1666667)
> [1] 2.471264
In short: you're doing it wrong.
You are passing 1.166 as the second parameter to the mean function.
See its help page to figure out what the params are: ?mean
You have to pass it in a *vector* of numbers to take the mean from:
R> mean(c(2.471264, 1.1666667))
[1] 1.818965
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the R-help
mailing list