Skip to content
Prev 181970 / 398513 Next

convert the contents of a date.frame to a matrix

Unable to reproduce:

 > ?data.matrix
 > x <- read.table(textConnection("  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"), header=TRUE)
 > x
    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
 > data.matrix(x)
    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

You may have something else in that dataframe that is not apparent on  
a simple print display. Can you instead provide the results of dput(x)?