-
Notifications
You must be signed in to change notification settings - Fork 978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[.data.table
accept both by
and keyby
non-missing
#1104
Comments
why not put the conditional outside of the data.table call? In the given example, there is not much harm, but it might open up to other errors requiring many more checks. |
Then it would be difficult to use chaining which is not exposed in that example. |
@rsaporta see line #L409 - hmm, looks like it can be done even easier just by I may prepare PR if there is a chance for that to be accepted. |
example code which suffers from lack of that feature is my dev version of ...
if (!missing(keyby)) {
if (!missing(by)) stop("you must provide 'by' or 'keyby', not both")
do.key = TRUE
by = keyby
} else if (!missing(by)) {
do.key = FALSE
}
tmp = if (do.key) {
x[, list(.ll.tech.split=list(.SD)), keyby=by, .SDcols=if(drop) setdiff(names(x), by) else names(x)]
} else x[, list(.ll.tech.split=list(.SD)), by=by, .SDcols=if(drop) setdiff(names(x), by) else names(x)]
... |
Alternatively |
closing as duplicate of newly created #4307 which is well defining requested behaviour |
I would like do conditional sort while making aggregation, I think
[.data.table
could be less restricted and check only if one ofby
andkeyby
is not null.The text was updated successfully, but these errors were encountered: