ACCLAB / dabestr

Data Analysis with Bootstrap Estimation in R
https://acclab.github.io/dabestr
Apache License 2.0
215 stars 34 forks source link

Error in reporting n numbers in printed output #73

Closed mfarrant closed 4 years ago

mfarrant commented 4 years ago

In the printed output of the dabest test, the n numbers for the control and test groups are reversed.

Examination of the output using str() shows the correct values, e.g. 9 control and 15 test in my example:

..$ control_group: chr "control" ..$ test_group : chr "test" ..$ control_size : int 9 ..$ test_size : int 15

However, the printed output shows the control and test n numbers reversed:

DABEST (Data Analysis with Bootstrap Estimation) v0.2.4

Variable: value

Unpaired mean difference of test (n=9) minus control (n=15) -18.7 [95CI -23.2; -13.9]

5000 bootstrap resamples. All confidence intervals are bias-corrected and accelerated.

Examination of the R code seems to suggest that two lines in print row_dabest are swapped:

printrow_dabest <- function(my.row, sigdig = 3) {
  if (identical(my.row$paired, TRUE)) p <- "Paired" else p <- "Unpaired"
  ffunc <- my.row$func
  line1 <- stringr::str_interp(
    c(
      "${p} ${ffunc} difference of ",
      "${my.row$test_group} ",
      "(n=${my.row$control_size}) ",
      "minus ${my.row$control_group} ",
      "(n=${my.row$test_size})\n"
    )
  )
josesho commented 4 years ago

Thanks for this bug report and detailed autopsy! This should be fixed in the upcoming release, which is slated for CRAN submission soon.

josesho commented 4 years ago

Resolved with v0.2.5 (PR #77)