prettyNum error
ecamburn opened this issue · comments
Love summarytools but I'm getting the following error when using ctable:
Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, :
invalid value 0 for 'digits' argument
Here's the line that generates the error. It's worked without problem in the past. I recently updated R (4.2.2) and RStudio (2022.07.2 Build 576). subject and eng are ordinal variables
ctable(tsubject$subject,tsubject$eng)
I'm having the same issue. The following code doesn't work:
ctable(c("a","b"), 1:2)
but the following does work:
ctable(c("a","b"), as.factor(1:2))
According to the help page, ctable should also accept numeric input.
This is probably due to change in R 4.2.0:
Setting digits = 0 in format(), print.default() (and hence typically print()) or options() is again invalid. Its behaviour was platform-dependent, and it is unclear what “zero significant digits” should mean (PR#18098).
https://cran.r-project.org/doc/manuals/r-devel/NEWS.html
Jarkko
A fix for this has been available already for a long time. Install the package from GitHub, if you want the fix. Hopefully version 1.0.2 of the package, containing the fix, will be released soon.