AndriSignorell / DescTools

Tools for Descriptive Statistics and Exploratory Data Analysis
http://andrisignorell.github.io/DescTools/
86 stars 18 forks source link

ConoverTest: allow character input (instead of factor) #92

Closed GegznaV closed 2 years ago

GegznaV commented 2 years ago

If the input (grouping variable) in ConoverTest() is accidentally a character and not a factor variable, a non-meaningful (user-unfriendly) error message is issued.

(This is just an example for reproduction, but I got a similar result with real data):

DescTools::ConoverTest(
    weight ~ as.character(feed),
    data = chickwts,
    method = "holm"
)
#> Error in ConoverTest.default(method = method, c(179, 160, 136, 227, 217, : all group levels must be finite

Created on 2022-05-22 by the reprex package (v2.0.1)

I think the behavior of function must be changed in either of 2 ways:

1) character could be automatically converted into a factor in the function (preferred); 2) or a meaningful error message that a grouping variable is not a factor should be issued.

AndriSignorell commented 2 years ago

Thanks for bringing this up, Vilmantas. I have fixed it for (as far as I can see) all post hoc tests in [0.99.45.2]. Please check and close the issue, if ok. Best, Andri

AndriSignorell commented 2 years ago

Solved and done.