dcomtois / summarytools

R Package to Quickly and Neatly Summarize Data
523 stars 78 forks source link

[Feature requiest]: Make different default rounding for different groups of statistics #95

Open GegznaV opened 5 years ago

GegznaV commented 5 years ago

In function descr(), the statistics can be divided into 5 types according to units of measurement and scales:

1) Mean, Std.Dev, Min, Q1, Median, Q3, Max, MAD, IQR are measured on the same scale as an input variable (rounding could be provided for each variable separately); 2) CV has relative units of measurement and its scale depends on the values of mean and SD; 3) Skewness, SE.Skewness, and Kurtosis are coefficients, centered around 0. So 2 decimal places are usually sufficient. 4) N.Valid is always an integer. No decimal places should be displayed. 5) Pct.Valid is measured on the scale of percentages so 0 to 2 decimal places are usually sufficient.

Could these groups of measures have different default rounding options?

dcomtois commented 5 years ago

For the ascii tables displayed in the console, this currently is not possible, as the number of digits shown depends on a pander argument that applies to the table as a whole. For html results, the N.Valid value is already shown without decimals (unless sampling weights are used). Specifying variable-specific rounding is feasible, although would require some work. I have a pretty busy schedule so I can't promise anything... But I'll leave the issue open and if you or others want to work on this feature, by all means do so!