Make a table showing numerical summary

numSummaryTable(x, ..., lang = "en", vanilla = FALSE)

Arguments

x

A grouped_df or a data.frame or a vector

...

further argument to be passed

lang

Language. choices are one of c("en","kor")

vanilla

Logical. Whether make vanilla table or not

Examples

require(moonBook) require(magrittr) require(dplyr) require(rrtable) require(webr) numSummaryTable(acs)
#> type: regulartable object. #> col_keys: `rowname`, `n`, `mean`, `sd`, `median`, `trimmed`, `mad`, `min`, `max`, `range`, `skew`, `kurtosis`, `se` #> header has 1 row(s) #> body has 9 row(s) #> original dataset sample: #> rowname n mean sd median trimmed mad min max range #> age age 857.00 63.31 11.70 64.00 63.56 13.34 28.00 91.00 63.00 #> EF EF 723.00 55.83 9.62 58.10 56.77 7.86 18.00 79.00 61.00 #> height height 764.00 163.18 9.08 165.00 163.52 7.41 130.00 185.00 55.00 #> weight weight 766.00 64.84 11.36 65.00 64.55 10.38 30.00 112.00 82.00 #> BMI BMI 764.00 24.28 3.35 24.16 24.16 3.01 15.62 41.42 25.80 #> skew kurtosis se #> age -0.18 -0.57 0.40 #> EF -0.98 1.11 0.36 #> height -0.44 -0.01 0.33 #> weight 0.34 0.44 0.41 #> BMI 0.67 2.12 0.12
numSummaryTable(acs$age)
#> type: regulartable object. #> col_keys: `rowname`, `n`, `mean`, `sd`, `median`, `trimmed`, `mad`, `min`, `max`, `range`, `skew`, `kurtosis`, `se` #> header has 1 row(s) #> body has 1 row(s) #> original dataset sample: #> rowname n mean sd median trimmed mad min max range skew #> X1 X1 857.00 63.31 11.70 64.00 63.56 13.34 28.00 91.00 63.00 -0.18 #> kurtosis se #> X1 -0.57 0.40
acs %>% group_by(sex) %>% select(age) %>% numSummaryTable
#> Adding missing grouping variables: `sex`
#> type: regulartable object. #> col_keys: `rowname`, `variable`, `sex`, `n`, `mean`, `sd`, `median`, `trimmed`, `mad`, `min`, `max`, `range`, `skew`, `kurtosis`, `se` #> header has 1 row(s) #> body has 2 row(s) #> original dataset sample: #> rowname variable sex n mean sd median trimmed mad min max #> 1 1 age Female 287.00 68.68 10.73 70.00 69.43 10.38 39.00 90.00 #> 2 2 age Male 570.00 60.61 11.23 61.00 60.65 11.86 28.00 91.00 #> range skew kurtosis se #> 1 51.00 -0.59 -0.26 0.63 #> 2 63.00 -0.01 -0.36 0.47
acs %>% group_by(sex) %>% select(age,EF) %>% numSummaryTable
#> Adding missing grouping variables: `sex`
#> type: regulartable object. #> col_keys: `rowname`, `variable`, `sex`, `n`, `mean`, `sd`, `median`, `trimmed`, `mad`, `min`, `max`, `range`, `skew`, `kurtosis`, `se` #> header has 1 row(s) #> body has 4 row(s) #> original dataset sample: #> rowname variable sex n mean sd median trimmed mad min max #> 1 1 age Female 287.00 68.68 10.73 70.00 69.43 10.38 39.00 90.00 #> 2 2 age Male 570.00 60.61 11.23 61.00 60.65 11.86 28.00 91.00 #> 3 3 EF Female 240.00 56.27 10.06 59.25 57.57 7.19 18.40 75.00 #> 4 4 EF Male 483.00 55.62 9.40 57.30 56.38 8.01 18.00 79.00 #> range skew kurtosis se #> 1 51.00 -0.59 -0.26 0.63 #> 2 63.00 -0.01 -0.36 0.47 #> 3 56.60 -1.30 1.70 0.65 #> 4 61.00 -0.79 0.76 0.43
acs %>% group_by(sex,Dx) %>% select(age,EF) %>% numSummaryTable(vanilla=FALSE)
#> Adding missing grouping variables: `sex`, `Dx`
#> type: regulartable object. #> col_keys: `rowname`, `variable`, `sex`, `Dx`, `n`, `mean`, `sd`, `median`, `trimmed`, `mad`, `min`, `max`, `range`, `skew`, `kurtosis`, `se` #> header has 1 row(s) #> body has 12 row(s) #> original dataset sample: #> rowname variable sex Dx n mean sd median trimmed #> 1 1 age Female NSTEMI 50.00 70.88 11.35 74.50 71.88 #> 2 2 age Female STEMI 84.00 69.11 10.36 70.00 70.04 #> 3 3 age Female Unstable Angina 153.00 67.72 10.67 70.00 68.33 #> 4 4 age Male NSTEMI 103.00 61.15 11.57 59.00 61.28 #> 5 5 age Male STEMI 220.00 59.43 11.72 59.50 59.43 #> mad min max range skew kurtosis se #> 1 8.90 42.00 88.00 46.00 -0.72 -0.34 1.61 #> 2 10.38 42.00 89.00 47.00 -0.65 -0.09 1.13 #> 3 8.90 39.00 90.00 51.00 -0.54 -0.34 0.86 #> 4 13.34 28.00 85.00 57.00 -0.11 -0.53 1.14 #> 5 11.12 30.00 86.00 56.00 0.00 -0.55 0.79
acs %>% group_by(sex,Dx) %>% numSummaryTable(age,EF,lang="kor")
#> type: regulartable object. #> col_keys: `rowname`, `variable`, `sex`, `Dx`, `n`, `평균`, `표준편차`, `중앙값`, `절단평균`, `중앙값절대편차`, `최소값`, `최대값`, `범위`, `왜도`, `첨도`, `표준오차` #> header has 1 row(s) #> body has 12 row(s) #> original dataset sample: #> rowname variable sex Dx n 평균 표준편차 중앙값 절단평균 #> 1 1 age Female NSTEMI 50.00 70.88 11.35 74.50 71.88 #> 2 2 age Female STEMI 84.00 69.11 10.36 70.00 70.04 #> 3 3 age Female Unstable Angina 153.00 67.72 10.67 70.00 68.33 #> 4 4 age Male NSTEMI 103.00 61.15 11.57 59.00 61.28 #> 5 5 age Male STEMI 220.00 59.43 11.72 59.50 59.43 #> 중앙값절대편차 최소값 최대값 범위 왜도 첨도 표준오차 #> 1 8.90 42.00 88.00 46.00 -0.72 -0.34 1.61 #> 2 10.38 42.00 89.00 47.00 -0.65 -0.09 1.13 #> 3 8.90 39.00 90.00 51.00 -0.54 -0.34 0.86 #> 4 13.34 28.00 85.00 57.00 -0.11 -0.53 1.14 #> 5 11.12 30.00 86.00 56.00 0.00 -0.55 0.79