[datatable-help] Unexpected behavior in setnames()

Arunkumar Srinivasan aragorn168b at gmail.com
Fri Nov 8 21:45:26 CET 2013


Oh I can certainly agree with that. I guess we'll have to make some changes to the code to use index based subsetting when .SDcols or j-value is number then. 

Arun


On Friday, November 8, 2013 at 9:41 PM, Steve Lianoglou wrote:

> My gut reaction is:
> 
> On Fri, Nov 8, 2013 at 12:37 PM, Arunkumar Srinivasan
> <aragorn168b at gmail.com (mailto:aragorn168b at gmail.com)> wrote:
> > Sure, here's an example of what I was trying to explain:
> > 
> > Suppose:
> > DT <- data.table(x=1:5, y=1:5, x=6:10)
> > 
> > Then,
> > 
> > DT[, c(1,3), with=FALSE] # gives correct subset
> 
> This is "OK", we just do what the user asks, here, as they are being
> very specific.
> 
> > DT[, c("x", "x"), with=FALSE] # gives column 1 twice - wrong
> 
> stop() -- we don't try to disambiguate (even if it "seems" specific)
> 
> > DT[, .SD, .SDcols=c("x", "x")] # gives column 1 twice - wrong result
> 
> stop()
> 
> Also stop() on DT[, ..., .SDcols="x"]
> 
> > DT[, .SD, .SDcols=c(1,3)] # gives column 1 twice - wrong result - but
> 
> Do what the user asks for.
> 
> No?
> 
> -steve
> 
> -- 
> Steve Lianoglou
> Computational Biologist
> Bioinformatics and Computational Biology
> Genentech
> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20131108/7564c243/attachment.html>


More information about the datatable-help mailing list