11
votes

I have a csv with column name in first row of the file, and column name in first column of the file, like this:

ColName1 ColName2 ... ColNameN
RowName1 ..
RowName2 ..
RowNameN .. 

If I use this command: read.csv("/Users/MNeptune/Documents/workspace R/simulatedProfiles.csv", header=TRUE)

I read correctly only columns name but not row name. What i can do to read row name?

2

2 Answers

23
votes

Try read.csv("filename.csv", row.names = 1, header= TRUE).

5
votes

There is a row.names option to read.csv (inherited from read.table) in which you can specify the column in the file to be used as row.names.

read.csv("/path/to/file", header=TRUE, row.names=1)