I want to read a .csv file in R, in order to draw a heat map. My .csv data looks like:
Label|AA|BB|CC|DD
YE1 |0.1|0.9|0.3|0.7|
YE2 |0.3|0.5|0.2|0.3|
NE1 |0.9|0.6|0.1|0.4|
NE2 |0.8|0.7|0.1|0.5|
AA to DD are features and Label represent the row names. I want to plot heat map of features vs Labels
In order to read a .csv file, I wrote the following:
data <- read.csv("C:/example.csv", row.names= 1)
But, this gives me an error.
Error in read.table(file = file, header = header, sep = sep, quote = quote, : duplicate 'row.names' are not allowed
I came across reading a csv file with repeated row names in R where the answer says set row.names = NULL
. But I don't want to set row.names = NULL
. I want to read the row names in the data frame. How to do this?
Thanks.