[R] Data import error: duplicate "row.names"

Gabor Grothendieck ggrothendieck at gmail.com
Fri Dec 7 17:53:10 CET 2007


Read your file in without row names and check for duplicates:

DF <- read.table(myfile, skip = 1, header = FALSE)
myfile[duplicated(DF[[1]]), ]  # list rows with duplicated column 1




On Dec 7, 2007 11:22 AM, Fan Yang <yangfan1 at msu.edu> wrote:
> Hi,
>
> I am trying to import a tab delimited file (converted from .xls file) by
>  >Test<-read.table("/Users/....txt", header=T, row.names=1)
>
> The command has always worked for me, but now I have been getting the
> error message saying that "duplicate 'row.names' are not allowed.  I
> have checked my original files and all names were unique.  I have
> also tried to change the sample names (as 1, 2, 3,..., 13), it was
> still returning the same error message "duplicate 'row.names' are not
> allowed" to me.  I have tried using "row.names=NULL", but it returned
> the column names as well.
>
> Does anyone know what the problem was?  Thanks
>
> Fan
>
> Fan Yang
> Industrial Microbiology
> 2209 Biomedical Phys Sci
> Michigan State University
> Phone: (517)355-6463 Ext 1588
> Email: yangfan1 at msu.edu
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list