[R] How to log-2 transform a matrix

Paul Smith phhs80 at gmail.com
Sat Nov 10 16:23:40 CET 2007


On Nov 10, 2007 2:49 PM, affy snp <affysnp at gmail.com> wrote:
> My matrix looks like:
>
> > dim(CGH)
> [1] 238304    243
> > CGH[1:30,1:4]
>               WM806SignalA WM1716SignalA WM1862SignalA WM1963SignalA
> SNP_A-1909444         1.59          1.48          1.78          2.59
> SNP_A-2237149         2.24          1.87          1.95          2.04
> SNP_A-4303947         2.02          1.70          1.90          2.36
> SNP_A-2236359         2.58          2.06          1.87          2.15
> SNP_A-2205441         1.87          1.46          1.86          2.40
>
> Even I tried log2(CGH[1:238304,1:243]), it did not work either. Based
> on the error
> message, which is:
>
> > CGHlog2<-log2(CGH[1:238304,1:243])
> Error in Math.data.frame(CGH[1:238304, 1:243]) :
>   non-numeric variable in data frame:
> WM806SignalAWM1716SignalAWM1862SignalAWM1963SignalAWM1968SignalAWM1976SignalAWM3228SignalAWM3457SignalAWM3061SignalAWM3246SignalAWM3282SignalAWM1931SignalAWM1026SignalAWM3670SignalAWM3702SignalAWM3482SignalAWM3311SignalAWM1960SignalAWM1720SignalAWM3215SignalAWM3451SignalAWM3130SignalAWM2029SignalAWM3243NCI.A5SignalAWM1745SignalAWM3526SignalAWM3682SignalAWM3623SignalAWM3450SignalAWM853.2SignalAWM1930SignalAWM3244NCI.BSignalAWM984SignalAWM3619SignalAWM3297SignalAWM451LuSignalAWM3077SignalAWM3381ASignalAWM3627SignalAWM3218SignalAWM3163SignalAWM3259SignalAWM3506SignalAWM3629SignalAWM3456SignalAWM1346SignalAWM1852SignalARCC13NSignalAJAPOV46NSignalAJAPOV75NSignalAS004285NSignalARCC50NSignalAJAPOV54NSignalAJAPOV92NSignalARCC56NSignalAS004288NSignalAS004295NSignalAS004292NSignalAJAPOV73NSignalAJAPOV52NSignalARCC53NSignalAS004289NSignalARCC25NSignalAS004294NSignalAS004275NSignalAJAPOV32NSignalACN37SignalACN16SignalAS004291NSignalACN17SignalARCC129NS
>
> it seems that the column names was messed up. How to solve this?

The first column is not numeric, I guess. That is the problem.

Paul



More information about the R-help mailing list