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 upcoalesce vectors of type list #3712
Comments
|
differences reported in tweet: coalesce(list(1, NA), list(NA, 2))
# The first argument is a list, data.table or data.frame. In this case there should be no other arguments provided.is a result of API improvement implemented in 1f0bcc7 where coalesce(list(c(1, NA), c(NA, 2)))
#[1] 1 2there is no gain for being consistent to dplyr/hutils in this case as they do nothing, this is related to point 1 above. never heard about tidy dots, could anyone provide a reference to R manual? or is it tidyverse-only feature? coalesce(1:2, 1:3)
#Error in coalesce(1:2, 1:3) :
Item 2 is length 3 but the first item is length 2. Only singletons are recycled.error, as it is now, it is definitely better, same as dplyr, unlike hutils coalesce(factor(NA,"a"), factor("a",c("a","b")))
#Error in coalesce(factor(NA, "a"), factor("a", c("a", "b"))) :
Item 2 is a factor but its levels are not identical to the first item's levels.being consistent to dplyr/hutils here doesn't seem to be great, they result into NAs. Ideally would be to merge factor levels. I would say current DT behaviour is acceptable, if we want to change this we should merge levels. |
|
related change coming to dplyr tidyverse/dplyr#5334 |
Thanks to Antoine Fabri for reporting here:
https://twitter.com/antoine_fabri/status/1151965060522237971
NB: there are 4 images in that tweet to consider.