Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign updata.table::if_else() or data.table::iif() #3657
Comments
|
alternatively |
|
For comparison, from the description:
|
|
I have shared with Matt a prototype implemented in C . Now, Example 1: (
Which behaviour do we want? My prototype currently outputs the same as dplyr which in Example 2: (
Again, Example 3:
In the above example, Option 1:( equivalent to
Option 2:
Option 3:
Option 4:
Option 1 can be turned into option 2 with a flag, so does option 3 with 4. Example 4:
Please let me know your thoughts. |
|
Example 1 should definitely retain Not to mention that, in a grouping context we have to be extra careful... Example 3 looks similar? Example 4 also doesn't make sense to me. I'm not sure how much attention we should devote to handling Please proceed to file a PR -- that way all members could have a glance at the code and help move things forward from there. |
|
Related: #673 and #2677 (of which this current issue is Please note also the discussion in #2677 about possibly patching |
|
Thank you for these useful links. It shows the need for a faster and more robust implementation. I will study them and share my code. Please be patient as I am working on this in my spare time. Thank you. |
|
You may also want consider |
|
Give that a try and let me know your thoughts:
|
|
Looks interesting. |
|
@jangorecki good point, was also thinking of how an API for I guess @mattdowle would have to grant branching access for the branch to be done within Rdatatable. |
Currently, the data.table way is chaining [ |
|
Closed by #3678 (forgot to use 'closes' prefix in PR comment) |
base::ifelse()is notorious slow and will change the attributes somehow.dplyr implements
dplyr::if_else()which I think is good. However, I always reluctant to use dplyr because of it's heavy dependencies.So I'm proposing a feature request here... I think both
data.table::if_else()anddata.table::iif()are good name candidates (though the former conflicts withdplyr::if_else())