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
While looking at #63 I recognize that countElements silently drops invalid elements if at least one valid element was found because of its very complex regular expression (that matches mostly valid element names):
countElements("C1Z")
# $C1Z# C # 1
countElements("Foo")
# $Foo# F # 1
In contrast if the invalid element is given without any valid one:
countElements("Z")
# $Z# named integer(0)## Warning message:# In (function (xx, rr) :# The following names are not valid and are dropped: 1
Because of that containsElements("C1", c("Z", "C1Z")) yield c(TRUE, TRUE) instead of c(FALSE, FALSE).
While it is easy to test if countElements returns an integer(0) (e.g. for "Z") it is not possible to test for dropped elements if there is at least one valid element (e.g. for "C1Z", we could test pasteElements(countElements("C1Z")) == "C1Z"), which would be error prone and slow).
Shouldn't we return NA if at least one element name is invalid (instead of currently silently dropping it or throw a warning if there is at least one valid element)?
The text was updated successfully, but these errors were encountered:
I'm perfectly fine with your solution! Does that mean we need to revert the fix in #62 ? in any rate, please update version and add NEWS and then merge. Thanks!
While looking at #63 I recognize that
countElements
silently drops invalid elements if at least one valid element was found because of its very complex regular expression (that matches mostly valid element names):In contrast if the invalid element is given without any valid one:
Because of that
containsElements("C1", c("Z", "C1Z"))
yieldc(TRUE, TRUE)
instead ofc(FALSE, FALSE)
.While it is easy to test if
countElements
returns aninteger(0)
(e.g. for"Z"
) it is not possible to test for dropped elements if there is at least one valid element (e.g. for"C1Z"
, we could testpasteElements(countElements("C1Z")) == "C1Z")
, which would be error prone and slow).Shouldn't we return
NA
if at least one element name is invalid (instead of currently silently dropping it or throw a warning if there is at least one valid element)?The text was updated successfully, but these errors were encountered: