[datatable-help] changing data.table by-without-by syntax to require a "by"

Michael Nelson michael.nelson at sydney.edu.au
Sat Apr 20 01:07:10 CEST 2013


I think this proposed  change is completely unnecessary.

That a function may behave differently is entirely consistent with the various s3 /s4 methods system (although neither are used here).

I think that drop = TRUE when implemented will take care of dropping join columns.



On 20/04/2013, at 5:54 AM, "eddi" <eduard.antonyan at gmail.com<mailto:eduard.antonyan at gmail.com>> wrote:

Matthew Dowle suggested I put this up for a discussion here.

This is continuation of the discussion that started on SO<http://stackoverflow.com/questions/16093289/data-table-join-and-j-expression-unexpected-behavior/> and resulted in FR2696<https://r-forge.r-project.org/tracker/index.php?func=detail&aid=2696&group_id=240&atid=978> (I recommend reading the latter first, as it's much more clear).

My case for the change boils down to the following: I believe d[i, j, by = b] should be always understood to mean

"take d, apply i, return j by b"

instead of the much more complicated current behavior, which is:

"take d, apply i, if i was not a merge, return j by b, if i was a merge, if no by, then return j by key, else if b and b == key, complain and return j by b, else return j by b"

I believe, while disruptive to some current users, this will make data.table much more user-friendly for any future users (one piece of evidence I would suggest for this, besides my plea, is that FAQs 1.13-1.14 (and part of 1.12) would become completely unnecessary).

This is regarding syntax only, and I do NOT propose any changes to underlying behavior, in particular the speed-up when you do a "by" by the key of the join should stay (and should be done iff by=key is present).

________________________________
View this message in context: changing data.table by-without-by syntax to require a "by"<http://r.789695.n4.nabble.com/changing-data-table-by-without-by-syntax-to-require-a-by-tp4664770.html>
Sent from the datatable-help mailing list archive<http://r.789695.n4.nabble.com/datatable-help-f2315188.html> at Nabble.com<http://Nabble.com>.
_______________________________________________
datatable-help mailing list
datatable-help at lists.r-forge.r-project.org<mailto:datatable-help at lists.r-forge.r-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130419/7dbaa46e/attachment.html>


More information about the datatable-help mailing list