This is similar to read.csv row.names and to https://stackoverflow.com/questions/12425599/duplicated-row-names , but I do not see answers that help.
Problem: Trying
If anyone else comes across this problem, my issue was that there were blank spaces in certain columns. After filling these spaces, my issue went away and I was able to load the .csv file just fine.
I was having the same problem. I merged the date with timestamps and now I am able to read from the csv.
You can generate a row number as the first column (say using python) in your csv and then read it again.
had the same problem. just added this line:
colnames(rec) <- c(colnames(rec)[-1],"x")
rec$x <- NULL
I used the following code:
lm.table <- read.table("file name", header=TRUE, row.names=NULL)
This added a column to the left with numbered row names, but I didn't find that the column names were shifted. Could it be that your column names still matched the right columns, but the R output made it look like the names had shifted?
My problem is associated with field separator for TAB-delimited file:
If I don't specify the field separator:
> condensed <- read.table("condense_report.tab", header=T)
Error in read.table("condense_report.tab", header = T) :
duplicate 'row.names' are not allowed
If I add the sep=TAB
condensed <- read.table("condense_report.tab", header=TRUE, sep="\t")
Then there is no error message.
Here is my file's content (^I is the TAB character, and $ is the end of line mark):
Sample^Imethod^Ispecies^Imean_frac^Istd_frac^Imean_dep^Imean_clsz^Inumrep$ asterix_potion^Imothur^IEnterococcus faecalis^I0.32290000^I0.021755985650701942^I3293.5000^I3309.7500^I4$ asterix_potion^Imothur^IAcinetobacter baumannii^I0.28010000^I0.021539851624928375^I2869.5000^I2880.7500^I4$
The problem is with the species column. It has spaces, and R is using both space and tab as delimiters by default. So you have an extra column than the header according to R if no sep option is given. This is the root of the problem.