[R] duplicate 'row.names' are not allowed

Petr PIKAL petr.pikal at precheza.cz
Tue Apr 28 14:53:21 CEST 2009


Hi

r-help-bounces at r-project.org napsal dne 28.04.2009 14:33:44:

> Thank you for your reply :)! Is it possible to solve the problem by 
using A.4,
> A.4a, A.9 and A.91? How one cand do this in R?

Yes but why? If you want to have some names A.whatever which can repeat 
itself then does not use it as row names and put it in separate column 
called e.g. mynames. In this column you can have any number of 
replications - if I am not mistaken somebody suggested it already.

You can imagine row.names more like row numbers and in that case you 
probably do not want to have several row numbers let say 42, do you?

Regards
Petr


>  
> Many thanks
> 
> 
> --- S Ellison <S.Ellison at lgc.co.uk> schrieb am Di, 28.4.2009:
> 
> 
> Von: S Ellison <S.Ellison at lgc.co.uk>
> Betreff: Re: [R] duplicate 'row.names' are not allowed
> An: r-help at stat.math.ethz.ch, "amor Gandhi" <amorigandhi at yahoo.de>
> Datum: Dienstag, 28. April 2009, 14:17
> 
> 
> You have used A.4 and A.9 twice.
> 
> Look at 
> > nam
> # or 
> > duplicated(nam)
> 
> 
> >>> amor Gandhi <amorigandhi at yahoo.de> 28/04/2009 13:04:03 >>>
> Hi everyone,
>> I have got the following problem:
>> x1 <- rnorm(10,5,1)
> x2 <- runif(10,0,1)
> nam1 <- paste("A",1:4,sep=".")
> nam2 <- paste("A",6:9,sep=".")
> nam <- c(nam1,"A.4",nam2,"A.9")
> mydata <- data.frame(x1,x2)
> rownames(mydata) <- nam
> Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1", "A.2", 
"A.3", : 
> duplicate 'row.names' are not allowed
> In addition: Warning message:
> non-unique values when setting 'row.names': *Ç˙A.4*ÇÖ, *Ç˙A.9*ÇÖ
>> I am very thankful for your help!
>> Amor
> 
> 
>       
>     [[alternative HTML version deleted]]
> 
> 
> *******************************************************************
> This email and any attachments are confidential. Any 
use...{{dropped:13}}
> 
> ______________________________________________
> 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