[R] Error Help: duplicate?

peter dalgaard pdalgd at gmail.com
Thu Aug 1 18:36:24 CEST 2013


On Aug 1, 2013, at 18:09 , Jeff Newmiller wrote:

> Your example is not reproducible, so we can only guess what is happening. Please read the footer of this (or any other R-help) email and follow those instructions. You may also find the discussion at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example helpful.

However, eliminating the reuse of newdata2 might help. In particular, if you accidentally repeat the cbind() step, you _will_ end up with a data frame with duplicate column names.

> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                      Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> --------------------------------------------------------------------------- 
> Sent from my phone. Please excuse my brevity.
> 
> Docbanks84 <mbanks3 at partners.org> wrote:
>> Hi,
>> 
>> I'm working through practice data in R and I am held up on this step. I
>> am
>> not sure why there is an error that claims there is a duplicate
>> subscript
>> for columns?
>> 
>> Does anyone know what this means and how I can fix it?
>> 
>>> 
>> newdata2<-cbind(newdata2,predict(mylogit,newdata=newdata2,type="link",se=TRUE))
>>> newdata2<-within(newdata2,{PredictedProb<-plogis(fit)
>> + LL<-plogis(fit- (1.96 * se.fit))
>> + UL<-plogis(fit + (1.96 *se.fit))
>> + })
>> Error in `[<-.data.frame`(`*tmp*`, nl, value = list(UL =
>> c(0.549206434665668,  : 
>> duplicate subscripts for columns
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/Error-Help-duplicate-tp4672819.html
>> Sent from the R help mailing list archive at Nabble.com.
>> 
>> ______________________________________________
>> 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.
> 
> ______________________________________________
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list