reading a csv file with repeated row names in R

try this:

S1N657 <- read.csv("S1N657.csv",header=T,fill=T,col.names=c("dam","anim","temp"), 
          row.names = NULL)[,-1]

Guessing your csv file was one converted from xlsx.Add a comma to the end of the first row ,remove the last row ,done


the function is seeing duplicate row names, so you need to deal with that. Probably the easiest way is with row.names=NULL, which will force row numbering--in other words, it treats your first column as the first dimension and not as the row numbers, and so adds row numbers (consecutive integers starting with "1".

read.csv("S1N657.csv", header=T,fill=T, col.names=c("dam","anim","temp"), row.names=NULL)

Tags:

R

Names

Row