- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 73
Description
Description
When a nominal vector has a lot of levels, and we compute a Kruskal test between this vector and a numerical one, the kruskal.test() function works fine, and returns fast. But the call to report() on the resulting object takes a long time, triggers a lot of warnings, and eventually fails with an error.
To Reproduce
The following code should reproduce the issue from scratch:
library("report")
n <- 200
df <- data.frame(a = as.factor(1:n), b = sample(30, n, replace = TRUE))
test <- kruskal.test(df$b, df$a)
report(test)
The last line of this code takes a lot of time to process, while the call to kruskal.test is instantaneous. The number of warnings seems to grow at least quadratically with n.
It eventually ends with:
[1] "All values of t are equal to  1 \n Cannot calculate confidence intervals"
Erreur dans data.frame(CI = ci, CI_low = bCI[1], CI_high = bCI[2]) : 
  les arguments impliquent des nombres de lignes différents : 1, 0
De plus : Il y a eu 50 avis ou plus (utilisez warnings() pour voir les 50 premiers)
Expected behaviour
I don't think report should have a bigger time complexity than the call to Kruskal.test, since it's only supposed to describe the results of that test, not perform additional computations. For the same reasons, the conditions of applications should be similar. When given a valid htest object, report should be able to describe it, even if that description has to involves some warnings and NAs.
Observed on version 0.5.8