[R] duplicate row importing issue

John Fox jfox at mcmaster.ca
Wed Jul 14 17:43:59 CEST 2004


Dear David,

If there is one fewer variable name in the first row of the data file than
fields in the remaining rows, then read.table() will treat the first entry
in each row as the row name. Simply add a new first variable (such as
"name") to the first row, and specify header=TRUE in the call to
read.table(). (Of course, this assumes that I've correctly guessed the
source of the problem.)

I hope that this helps,
 John

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of 
> Herman, David (NIH/NIMH)
> Sent: Wednesday, July 14, 2004 10:13 AM
> To: 'r-help at stat.math.ethz.ch'
> Subject: [R] duplicate row importing issue
> 
> Hello,
>             I'm simply trying to import a .txt file that has 
> a column of about 30,000 pts. I found the file, but I'm 
> getting an error:
> > m <- read.table(choose.files())
> Error in "row.names<-.data.frame"(`*tmp*`, value = row.names) : 
>         duplicate row.names are not allowed
>  
> Any help with getting around this?
>  
> I really appreciate all the help.
> Thanks
> dave
>




More information about the R-help mailing list