[R] reading files with name columns and row columns

Bogdan Tanasa tanasa at gmail.com
Thu Sep 3 00:11:22 CEST 2015


Dear all,

would appreciate a piece of help with a simple question: I am reading in R
a file that is formatted as a matrix (an example is shown below, although
it is more complex, a matrix of 1000 * 1000 ):

the names of the columns are 0, 10000, 40000, 80000, etc
the names of the rows are 0, 10000, 40000, 80000, etc

           0 200000 400000
0          0       0       0
200000  0       0       0
400000  0       0       0

shall I use the command :

y <- read.table("file",row.names=1, header=T)

the results is :

> y[1:3,1:3]
       X0 X200000 X400000
0       0       0       0
200000  0       0       0
400000  0       0       0

The question is : why R adds an X to the names of the columns eg X0,
X20000, X40000, when it shall be only 0, 20000, 40000 ? thanks !

-- bogdan

	[[alternative HTML version deleted]]



More information about the R-help mailing list