On Fri, Nov 8, 2013 at 12:45 PM, Arunkumar Srinivasan <[email protected]> wrote: > 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.
Not sure what you mean by j-value -- the examples you gave didn't compute on the .SD, it just returned it. I think if there is a `j` expression that computes on an .SD that has duplicated colnames, I think we just stop(). Or did you mean something else? -steve > 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 > <[email protected]> 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 > > > > _______________________________________________ > datatable-help mailing list > [email protected] > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -- Steve Lianoglou Computational Biologist Bioinformatics and Computational Biology Genentech _______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
