You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As @MichaelChirico metioned in #3740 (comment), we have 10 functions named with prefix f (some are no conflicts with base). However, coalesce() is an exception. I support @MichaelChirico 's idea that making the function names as consistent as possible.
So I think it may be better to rename the function coalesce() to fcoalesce() since it's not been published on CRAN yet.
Main factor for deciding names should be not overlapping to base R. Although I named frollmean to not overlap to zoo's function. Anyway my vote goes for keeping coalesce, overlapping shouldn't be very problematic here as both functions behaves quite the same. fcoalesce is not that obvious what it is.
@jangorecki just to push back a little, why cater frollmean not to overlap w zoo, but it's ok for coalesce to overlap with dplyr/hutils?
Not arguing strongly for fcoalesce (I'm kind of indifferent TBH), but rather think if we're going to close it would be best to have complete arguments laid out here to refer back to
zoo::rollmean has different defaults than frollmean, (align arg) thus will yield different answer
name of the function doesn't sound so artificial, "roll" from rolling, and "mean", adding "f" ("fast") prefix to this sounds more natural than adding to an artificial name "coalesce" which for me is just an SQL keyword not having any other meaning.
this is rather personal opinion, but I found using data.table+zoo more common than data.table+dplyr
Exporting coalesce causes warnings in revdeps grattan, mlr, OpenML, vosonSML, at least.
The warning (just because it's any warning) would need to be resolved by communication with those maintainers. But more significantly, those packages may start to use our new coalesce; we would inflict it on them without them asking. That inflict happens for mlr and OpenML but not grattan or vosonSML; I guess the difference is the order they import the packages. One bug in our coalesce revealed by mlr (#3826) in revdep testing because of a difference between our coalesce and BBmisc::coalesce. So it was good to call it coalesce otherwise we wouldn't have found that. But we shouldn't force the new function on them, until a few years have passed anyway. (Aside: dplyr::coalesce returns the same type error we did in that coalesce(NULL,"foo") example, I'd say dplyr::coalesce needs to fix that too).
The case for changing to fcoalesce seems clear then. We can still optimize coalesce inside DT[...] to use fcoalesce and we can export fcoalesce too.
Warning: replacing previous import 'data.table::coalesce' by 'hutils::coalesce' when loading 'grattan'
Warning: replacing previous import ‘BBmisc::coalesce’ by ‘data.table::coalesce’ when loading ‘mlr’
Warning: replacing previous import ‘BBmisc::coalesce’ by ‘data.table::coalesce’ when loading ‘OpenML’
Warning: replacing previous import ‘data.table::coalesce’ by ‘dplyr::coalesce’ when loading ‘vosonSML’
That's because BBmisc::coalesce is not like the other 3 coalesce (hutils, dplyr and data.table). Instead, it returns the "first non-missing, non-null argument, otherwise NULL." mlr is relying on that. This further points to change to fcoalesce.
Activity
[-]Rename [/-][+]Rename coalesce() to fcoalesce()[/+]jangorecki commentedon Aug 9, 2019
Main factor for deciding names should be not overlapping to base R. Although I named
frollmeanto not overlap tozoo's function. Anyway my vote goes for keepingcoalesce, overlapping shouldn't be very problematic here as both functions behaves quite the same.fcoalesceis not that obvious what it is.MichaelChirico commentedon Aug 9, 2019
@jangorecki just to push back a little, why cater
frollmeannot to overlap wzoo, but it's ok forcoalesceto overlap withdplyr/hutils?Not arguing strongly for
fcoalesce(I'm kind of indifferent TBH), but rather think if we're going to close it would be best to have complete arguments laid out here to refer back tojangorecki commentedon Aug 9, 2019
zoo::rollmeanhas different defaults thanfrollmean, (alignarg) thus will yield different answerjangorecki commentedon Aug 9, 2019
btw. there was discussion related to frollmean naming: https://github.com/orgs/Rdatatable/teams/project-members/discussions/5
shrektan commentedon Aug 19, 2019
After a second thought, I think the current name is ok. Close this for now.
mattdowle commentedon Sep 5, 2019
revdep testing #3581 reveals the wrinkle.
Exporting
coalescecauses warnings in revdepsgrattan,mlr,OpenML,vosonSML, at least.The warning (just because it's any warning) would need to be resolved by communication with those maintainers. But more significantly, those packages may start to use our new
coalesce; we would inflict it on them without them asking. That inflict happens formlrandOpenMLbut notgrattanorvosonSML; I guess the difference is the order they import the packages. One bug in ourcoalescerevealed bymlr(#3826) in revdep testing because of a difference between ourcoalesceandBBmisc::coalesce. So it was good to call itcoalesceotherwise we wouldn't have found that. But we shouldn't force the new function on them, until a few years have passed anyway. (Aside:dplyr::coalescereturns the same type error we did in thatcoalesce(NULL,"foo")example, I'd saydplyr::coalesceneeds to fix that too).The case for changing to
fcoalesceseems clear then. We can still optimizecoalesceinsideDT[...]to usefcoalesceand we can exportfcoalescetoo.mattdowle commentedon Sep 5, 2019
Even with #3826 fixed,
mlrstill fails due tocoalesce.That's because
BBmisc::coalesceis not like the other 3 coalesce (hutils, dplyr and data.table). Instead, it returns the "first non-missing, non-null argument, otherwise NULL."mlris relying on that. This further points to change tofcoalesce.jangorecki commentedon Sep 6, 2019
@mllg FYI