matthieugomez / statar

R package for data manipulation — inspired by Stata's API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zeroes reported as 0.0e+00

gvelasq opened this issue · comments

The new number formatting system is causing some zeroes to be reported as 0.0e+00.

> tab(mtcars, gear, vs, am)
 
    gearvsamFreq.  Percent     Cum. 
─────────┼──────────┼──────────┼────────────────────────────
       30.0e+000.0e+0012    37.50    37.50 
       310.0e+003     9.38    46.88 
---------------------------------------------------------
       40.0e+0012     6.25    53.12 
       410.0e+004    12.50    65.62 
       4116    18.75    84.38 
---------------------------------------------------------
       50.0e+0014    12.50    96.88 
       5111     3.12   100.00 

> sum_up(mtcars, gear, vs, am)
 
VariableObs  Missing     Mean   StdDev      Min      Max 
─────────┼───────────────────────────────────────────────────────
    am32        0  0.40625  0.49899  0.0e+00        1 
    gear32        0   3.6875   0.7378        3        5 
    vs32        0   0.4375  0.50402  0.0e+00        1 

thanks. solved by 8115649

Just to expand a little bit on the current formatting system, the function format_fixedwidth_number(x, w) is supposed to mimic di %w.0g x in stata.