summarytools
summarytools copied to clipboard
fix: invalid value 0 for 'digits' argument
Since R 4.2.0, digits
arguments of format()
is constrained to be higher or equal to 1.
nsmall
set to zero should be enough to get the requested "integer" format.
This PR, ensures digits is at least 1
in print_ctable()
.
fixes #163
-
master
branch (current behaviour)data("tobacco") ctable(tobacco$gender, tobacco$smoker, round.digits = 0) #> Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, : #> invalid value 0 for 'digits' argument
-
PR
data("tobacco") ctable(tobacco$gender, tobacco$smoker, round.digits = 0) #> Cross-Tabulation, Row Proportions #> gender * smoker #> Data Frame: tobacco #> #> -------- -------- ----------- ----------- ------------- #> smoker Yes No Total #> gender #> F 147 (30%) 342 (70%) 489 (100%) #> M 143 (29%) 346 (71%) 489 (100%) #> <NA> 8 (36%) 14 (64%) 22 (100%) #> Total 298 (30%) 702 (70%) 1000 (100%) #> -------- -------- ----------- ----------- -------------------