Table with descriptive statistics

nice_descriptives(
  data,
  round = NULL,
  auto_labels = FALSE,
  title = "Descriptive statistics",
  footnote = NULL,
  file = NULL,
  ...
)

Arguments

data

A data frame

round

Digits for round function

auto_labels

If TRUE, variable names are taken from a label attribute.

Value

A data frame with descriptive statistics

Examples

nice_descriptives(mtcars)
Table
Descriptive statistics
Variable Valid Missing Mean SD Min Max Range Median MAD
mpg 32 0 20.090625 6.0269481 10.400 33.900 23.500 19.200 5.4114900
cyl 32 0 6.187500 1.7859216 4.000 8.000 4.000 6.000 2.9652000
disp 32 0 230.721875 123.9386938 71.100 472.000 400.900 196.300 140.4763500
hp 32 0 146.687500 68.5628685 52.000 335.000 283.000 123.000 77.0952000
drat 32 0 3.596563 0.5346787 2.760 4.930 2.170 3.695 0.7042350
wt 32 0 3.217250 0.9784574 1.513 5.424 3.911 3.325 0.7672455
qsec 32 0 17.848750 1.7869432 14.500 22.900 8.400 17.710 1.4158830
vs 32 0 0.437500 0.5040161 0.000 1.000 1.000 0.000 0.0000000
am 32 0 0.406250 0.4989909 0.000 1.000 1.000 0.000 0.0000000
gear 32 0 3.687500 0.7378041 3.000 5.000 2.000 4.000 1.4826000
carb 32 0 2.812500 1.6152000 1.000 8.000 7.000 2.000 1.4826000
Note. MAD is the median average deviation with a consistency adjustment.
nice_descriptives(wmisc:::mtcars_labeled, auto_labels = TRUE, round = 2)
Table
Descriptive statistics
Variable Valid Missing Mean SD Min Max Range Median MAD
Miles/(US) gallon 32 0 20.09 6.03 10.40 33.90 23.50 19.20 5.41
Number of cylinders 32 0 6.19 1.79 4.00 8.00 4.00 6.00 2.97
Displacement (cu.in.) 32 0 230.72 123.94 71.10 472.00 400.90 196.30 140.48
Gross horsepower 32 0 146.69 68.56 52.00 335.00 283.00 123.00 77.10
Rear axle ratio 32 0 3.60 0.53 2.76 4.93 2.17 3.70 0.70
Weight (1000 lbs) 32 0 3.22 0.98 1.51 5.42 3.91 3.33 0.77
1/4 mile time 32 0 17.85 1.79 14.50 22.90 8.40 17.71 1.42
Engine (0 = V-shaped, 1 = straight) 32 0 0.44 0.50 0.00 1.00 1.00 0.00 0.00
Transmission (0 = automatic, 1 = manual) 32 0 0.41 0.50 0.00 1.00 1.00 0.00 0.00
Number of forward gears 32 0 3.69 0.74 3.00 5.00 2.00 4.00 1.48
Number of carburetors 32 0 2.81 1.62 1.00 8.00 7.00 2.00 1.48
Note. MAD is the median average deviation with a consistency adjustment.