Dear R user,

I am trying to convert the contents of a date.frame to a matrix. Since there
are negative values in the date.frame, when I use data.matrix(x,
rownames.force = NA), the resulting matrix is not the same as the original
one. Basically I think R treats the numbers in the date.frame as character
and converts it to corresponding numerics.

Any idea on this issue?

Many Thanks,

Hongyuan

 x[1:3,]
   ALL ALL.1 ALL.2 ALL.3 ALL.4 ALL.5 ALL.6 ALL.7 ALL.8 ALL.9 ALL.10 ALL.11
2 -214  -139   -76  -135  -106  -138   -72  -413     5   -88   -165    -67
3 -153   -73   -49  -114  -125   -85  -144  -260  -127  -105   -155    -93
4  -58    -1  -307   265   -76   215   238     7   106    42    -71     84
  ALL.12 ALL.13 ALL.14 ALL.15 ALL.16 ALL.17 ALL.18 ALL.19 ALL.20 ALL.21
ALL.22
2    -92   -113   -107   -117   -476    -81    -44     17   -144   -247
-74
3   -119   -147    -72   -219   -213   -150    -51   -229   -199    -90
-321
4    -31   -118   -126    -50    -18   -119    100     79   -157   -168
-11
  ALL.23 ALL.24 ALL.25 ALL.26  AML AML.1 AML.2 AML.3 AML.4 AML.5 AML.6 AML.7
2   -120    -81   -112   -273  -20     7  -213   -25   -72    -4    15  -318
3   -263   -150   -233   -327 -207  -100  -252   -20  -139  -116  -114  -192
4   -114    -85    -78    -76  -50   -57   136   124    -1  -125     2   -95
  AML.8 AML.9 AML.10 ALL.27 ALL.28 ALL.29 ALL.30 ALL.31 ALL.32 ALL.33 ALL.34
2   -32  -124   -135   -342    -87     22   -243   -130   -256    -62     86
3   -49   -79   -186   -200   -248   -153   -218   -177   -249    -23    -36
4    49   -37    -70     41    262     17   -163    -28   -410     -7   -141
  ALL.35 ALL.36 ALL.37 ALL.38 ALL.39 ALL.40 ALL.41 ALL.42 ALL.43 ALL.44
ALL.45
2   -146   -187    -56    -55    -59   -131   -154    -79    -76    -34
-95
3    -74   -187    -43    -44   -114   -126   -136   -118    -98   -144
-118
4    170    312     43     12     23    -50     49    -30   -153    -17
59
  ALL.46 AML.11 AML.12 AML.13 AML.14 AML.15 AML.16 AML.17 AML.18 AML.19
AML.20
2    -12    -21   -202   -112   -118    -90   -137   -157   -172    -47
-62
3   -172    -13   -274   -185   -142    -87    -51   -370   -122   -442
-198
4     12      8     59     24    212    102    -82    -77     38    -21
-5
  AML.21 AML.22 AML.23 AML.24
2    -58   -161    -48   -176
3   -217   -215   -531   -284
4     63    -46   -124    -81
>
> help(as.matrix)
> y = data.matrix(x, rownames.force = NA)
> y[1:3,]
  ALL ALL.1 ALL.2 ALL.3 ALL.4 ALL.5 ALL.6 ALL.7 ALL.8 ALL.9 ALL.10 ALL.11
2 195    75   620    76    13    58   466   399  1967   472     97    377
3 106   533   467    37    39   433    89   278    68    12     83    432
4 499     1   315  1458   407   891  1096  1819   718  1320    476   1436
  ALL.12 ALL.13 ALL.14 ALL.15 ALL.16 ALL.17 ALL.18 ALL.19 ALL.20 ALL.21
ALL.22
2    446     25     11     30    489    428    308   1156     52    178
381
3     30     87    438    159    244     61    346    188    103    482
196
4    219     33     37    383    186     28    474   2449     64    101
23
  ALL.23 ALL.24 ALL.25 ALL.26 AML AML.1 AML.2 AML.3 AML.4 AML.5 AML.6 AML.7
2     35    485     23    278 173  1178   186   254   545   362   602   318
3    203     81    167    330 181     1   228   190    75    39    20   181
4     26    496    467    596 443   276   869   867     1    55   775   676
  AML.8 AML.9 AML.10 ALL.27 ALL.28 ALL.29 ALL.30 ALL.31 ALL.32 ALL.33 ALL.34
2   273    67    102    169    544   1043     87     63    272    294   1226
3   386   615    190     94    196     86     74    130    267    109    170
4  1569   360    611   1004   1162    897     43    241    404    308     48
  ALL.35 ALL.36 ALL.37 ALL.38 ALL.39 ALL.40 ALL.41 ALL.42 ALL.43 ALL.44
ALL.45
2     55    130    253    281    376     38     89    466    361    133
329
3    372    130    213    238     24     33     66     32    397     36
25
4    725   1231   1041    488   1028    316   1748    222     60     50
1020
  ALL.46 AML.11 AML.12 AML.13 AML.14 AML.15 AML.16 AML.17 AML.18 AML.19
AML.20
2     22    131    170     21     47    381     36     67     77    279
403
3     52     42    245    100     97    374    236    166     28    265
130
4    397   1714   1932    915   1289    409    316    293   1054    136
351
  AML.21 AML.22 AML.23 AML.24
2    218    132    324     76
3     74    209    344    140
4   1015    420     65    342

	[[alternative HTML version deleted]]


