In the following example if you jump into check_args(), it passes but for the wrong reasons.
check_args() doesn't eval in the environment. so floor(nrow(data)/3) becomes nuemric(0) because nrow(data) is NULL because data is a function...
Ideally we should handle it better. There might be reasons why we don't, but we should be sure. it also means that the checking right now needs to be looser than I would like, as checking "1 or 0" length isn't as good as checking "1" length.
From https://github.com/tidymodels/parsnip/blob/dc9a66e2424d2aed3d5c6663f1a997fdb5fac0ec/R/README.md?plain=1#L58
In the following example if you jump into
check_args()
, it passes but for the wrong reasons.check_args()
doesn't eval in the environment. sofloor(nrow(data)/3)
becomesnuemric(0)
becausenrow(data)
isNULL
becausedata
is a function...Ideally we should handle it better. There might be reasons why we don't, but we should be sure. it also means that the checking right now needs to be looser than I would like, as checking "1 or 0" length isn't as good as checking "1" length.
Created on 2024-04-02 with reprex v2.1.0