verbal-autopsy-software / InSilicoVA

R package for InSilicoVA framework
3 stars 6 forks source link

Enhancement: Perform argument checking up front for test type #20

Closed mjutras-mitre closed 4 years ago

mjutras-mitre commented 5 years ago

The test parameter to the csmf.diag function is a character vector of candidate values ("gelman", "heidel"). It would make sense to do some argument checking at this point to ensure a correct test is used. What happens now is, for an erroneous test such as "notatest", the error shown for such an erroneous test is not clear. (which may have just been a typo such as "gelmam"). The error displayed says :

object 'conv' not found

This could be prevented by checking right away using match.arg right at the top of the csmf.diag function.

https://github.com/verbal-autopsy-software/InSilicoVA/blob/7f770ac7ab8d82c1b9de25debc7e734f06273df8/InSilicoVA/R/diag.r#L120