Closed sgibb closed 11 months ago
I add (currently failing) unit tests in the issue63-containsElements-returns-TRUE-for-invalid-elements branch. https://github.com/rformassspectrometry/MetaboCoreUtils/compare/issue63-containsElements-returns-TRUE-for-invalid-elements?expand=1
Thanks for adding this issue! Can you maybe work on that?
fixed by #65
containsElements
returnsTRUE
(with a warning) for characters that are not valid elements:Created on 2023-08-02 with reprex v2.0.2
It should return
FALSE
(without a warning).It would be possible to add something like
in the
mapply
ofcountElements
https://github.com/rformassspectrometry/MetaboCoreUtils/blob/7294eecf45a46e873c296edee8eb5e4af3c04ea0/R/chemFormula.R#L55-L75 (after theif (is.na(xx))
statement introduced in #62 ) and test forlength(x) == 0
incontainsElements
but that would break many unit tests intest_adducts.R
(.pasteElements
throws an error because of an unnamed argument instead of silently return""
; even returning a namedinteger(0)
results in many other failures intest_adducts.R
).