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?
The read_csv function imports data into R as a tibble, while read. csv imports a regular old R data frame instead.
• The header = TRUE argument tells R that the first row of your. file contains the variable names.
Try read.csv("filename.csv", row.names = 1, header= TRUE)
.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With