<div>
Sorry, forget the j-value. For `.SDcols`, even when we provide integers (column numbers), internally, we compute the column name and subset to get `.SD`. And this'll have to change.
</div>
<div><div><br></div><div>Arun</div><div><br></div></div>
<p style="color: #A0A0A8;">On Friday, November 8, 2013 at 9:47 PM, Steve Lianoglou wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div><div>On Fri, Nov 8, 2013 at 12:45 PM, Arunkumar Srinivasan</div><div><<a href="mailto:aragorn168b@gmail.com">aragorn168b@gmail.com</a>> wrote:</div><blockquote type="cite"><div><div>Oh I can certainly agree with that. I guess we'll have to make some changes</div><div>to the code to use index based subsetting when .SDcols or j-value is number</div><div>then.</div></div></blockquote><div><br></div><div>Not sure what you mean by j-value -- the examples you gave didn't</div><div>compute on the .SD, it just returned it.</div><div><br></div><div>I think if there is a `j` expression that computes on an .SD that has</div><div>duplicated colnames, I think we just stop().</div><div><br></div><div>Or did you mean something else?</div><div><br></div><div>-steve</div><div><br></div><blockquote type="cite"><div><div>On Friday, November 8, 2013 at 9:41 PM, Steve Lianoglou wrote:</div><div><br></div><div>My gut reaction is:</div><div><br></div><div>On Fri, Nov 8, 2013 at 12:37 PM, Arunkumar Srinivasan</div><div><<a href="mailto:aragorn168b@gmail.com">aragorn168b@gmail.com</a>> wrote:</div><div><br></div><div>Sure, here's an example of what I was trying to explain:</div><div><br></div><div>Suppose:</div><div>DT <- data.table(x=1:5, y=1:5, x=6:10)</div><div><br></div><div>Then,</div><div><br></div><div>DT[, c(1,3), with=FALSE] # gives correct subset</div><div><br></div><div><br></div><div>This is "OK", we just do what the user asks, here, as they are being</div><div>very specific.</div><div><br></div><div>DT[, c("x", "x"), with=FALSE] # gives column 1 twice - wrong</div><div><br></div><div><br></div><div>stop() -- we don't try to disambiguate (even if it "seems" specific)</div><div><br></div><div>DT[, .SD, .SDcols=c("x", "x")] # gives column 1 twice - wrong result</div><div><br></div><div><br></div><div>stop()</div><div><br></div><div>Also stop() on DT[, ..., .SDcols="x"]</div><div><br></div><div>DT[, .SD, .SDcols=c(1,3)] # gives column 1 twice - wrong result - but</div><div><br></div><div><br></div><div>Do what the user asks for.</div><div><br></div><div>No?</div><div><br></div><div>-steve</div><div><br></div><div>--</div><div>Steve Lianoglou</div><div>Computational Biologist</div><div>Bioinformatics and Computational Biology</div><div>Genentech</div><div><br></div><div><br></div><div><br></div><div>_______________________________________________</div><div>datatable-help mailing list</div><div><a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a></div><div><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a></div></div></blockquote><div><br></div><div><br></div><div><br></div><div>-- </div><div>Steve Lianoglou</div><div>Computational Biologist</div><div>Bioinformatics and Computational Biology</div><div>Genentech</div></div></div></span>
</blockquote>
<div>
<br>
</div>