karoliskoncevicius / matrixTests

R package for computing multiple hypothesis tests on rows/columns of a matrix or a data.frame
https://cran.r-project.org/web/packages/matrixTests/index.html
36 stars 5 forks source link

Adjust wilcoxon test warning messages when all the values are constant #27

Open karoliskoncevicius opened 2 years ago

karoliskoncevicius commented 2 years ago

Currently row_wilcoxon_twosample does not produce a warning when all the values are constant and equal to the NULL:

row_wilcoxon_twosample(c(1,1,1), c(2,2,2), exact=FALSE, null=1)
# NaN p-value but no warning

In a similar situation row_wilcoxon_onesample() can end up producing three warnings for the same row:

row_wilcoxon_onesample(c(0,0,0))
# 3 separate warnings are produced

And the above issue is also present in a paired version.

Solution: add the warning for "twosample" case and adjust the warnings so that only one is produced at the time.