Numerical Summary

numSummary(x, ..., digits = 2, lang = "en")

numSummary1(x, ..., digits = 2, lang = "en")

numSummary2(x, ..., digits = 2, lang = "en")

Arguments

x

A numeric vector or a data.frame or a grouped_df

...

further arguments to be passed

digits

integer indicating the number of decimal places

lang

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

Functions

  • numSummary1: Numerical Summary of a data.frame or a vector

  • numSummary2: Numerical Summary of a grouped_df

Examples

require(moonBook) require(magrittr)
#> Loading required package: magrittr
require(dplyr) require(rrtable)
#> Loading required package: rrtable
require(webr) require(tibble)
#> Loading required package: tibble
numSummary(acs)
#> # A tibble: 9 x 12 #> n mean sd median trimmed mad min max range skew kurtosis #> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 857 63.3 11.7 64 63.6 13.3 28 91 63 -0.175 -0.566 #> 2 723 55.8 9.62 58.1 56.8 7.86 18 79 61 -0.978 1.11 #> 3 764 163. 9.08 165 164. 7.41 130 185 55 -0.440 -0.0145 #> 4 766 64.8 11.4 65 64.5 10.4 30 112 82 0.336 0.444 #> 5 764 24.3 3.35 24.2 24.2 3.01 15.6 41.4 25.8 0.668 2.12 #> 6 834 185. 47.8 183 184. 43.0 25 493 468 0.737 3.77 #> 7 833 117. 41.1 114 115. 40.0 15 366 351 0.787 2.33 #> 8 834 38.2 11.1 38 38.0 10.4 4 89 85 0.366 1.46 #> 9 842 125. 90.9 106. 111. 60.0 11 877 866 3.02 14.9 #> # ... with 1 more variable: se <dbl>
numSummary(acs$age)
#> # A tibble: 1 x 12 #> n mean sd median trimmed mad min max range skew kurtosis #> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 857 63.3 11.7 64 63.6 13.3 28 91 63 -0.175 -0.566 #> # ... with 1 more variable: se <dbl>
acs %>% group_by(sex) %>% select(age) %>% numSummary
#> Adding missing grouping variables: `sex`
#> # A tibble: 2 x 14 #> variable sex n mean sd median trimmed mad min max range #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 age Female 287 68.7 10.7 70 69.4 10.4 39 90 51 #> 2 age Male 570 60.6 11.2 61 60.6 11.9 28 91 63 #> # ... with 3 more variables: skew <dbl>, kurtosis <dbl>, se <dbl>
acs %>% group_by(sex) %>% select(age,EF) %>% numSummary
#> Adding missing grouping variables: `sex`
#> # A tibble: 4 x 14 #> variable sex n mean sd median trimmed mad min max range #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 age Female 287 68.7 10.7 70 69.4 10.4 39 90 51 #> 2 age Male 570 60.6 11.2 61 60.6 11.9 28 91 63 #> 3 EF Female 240 56.3 10.1 59.2 57.6 7.19 18.4 75 56.6 #> 4 EF Male 483 55.6 9.40 57.3 56.4 8.01 18 79 61 #> # ... with 3 more variables: skew <dbl>, kurtosis <dbl>, se <dbl>
acs %>% group_by(sex,Dx) %>% select(age,EF) %>% numSummary
#> Adding missing grouping variables: `sex`, `Dx`
#> # A tibble: 12 x 15 #> variable sex Dx n mean sd median trimmed mad min max #> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 age Female NSTEMI 50 70.9 11.4 74.5 71.9 8.90 42 88 #> 2 age Female STEMI 84 69.1 10.4 70 70.0 10.4 42 89 #> 3 age Female Unstable… 153 67.7 10.7 70 68.3 8.90 39 90 #> 4 age Male NSTEMI 103 61.1 11.6 59 61.3 13.3 28 85 #> 5 age Male STEMI 220 59.4 11.7 59.5 59.4 11.1 30 86 #> 6 age Male Unstable… 247 61.4 10.6 61 61.4 10.4 35 91 #> 7 EF Female NSTEMI 45 54.8 9.10 57 55.3 9.79 36.8 75 #> 8 EF Female STEMI 77 52.3 10.9 55.7 53.7 9.04 18.4 67.1 #> 9 EF Female Unstable… 118 59.4 8.76 61.1 60.8 5.49 22 71.9 #> 10 EF Male NSTEMI 94 55.1 9.42 58 55.9 7.12 21.8 74 #> 11 EF Male STEMI 195 52.4 8.90 54 52.9 8.45 18 73.6 #> 12 EF Male Unstable… 194 59.1 8.67 60 60.2 5.93 24.7 79 #> # ... with 4 more variables: range <dbl>, skew <dbl>, kurtosis <dbl>, se <dbl>
acs %>% group_by(sex,Dx) %>% select(age) %>% numSummary
#> Adding missing grouping variables: `sex`, `Dx`
#> # A tibble: 6 x 15 #> variable sex Dx n mean sd median trimmed mad min max range #> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 age Fema… NSTE… 50 70.9 11.4 74.5 71.9 8.90 42 88 46 #> 2 age Fema… STEMI 84 69.1 10.4 70 70.0 10.4 42 89 47 #> 3 age Fema… Unst… 153 67.7 10.7 70 68.3 8.90 39 90 51 #> 4 age Male NSTE… 103 61.1 11.6 59 61.3 13.3 28 85 57 #> 5 age Male STEMI 220 59.4 11.7 59.5 59.4 11.1 30 86 56 #> 6 age Male Unst… 247 61.4 10.6 61 61.4 10.4 35 91 56 #> # ... with 3 more variables: skew <dbl>, kurtosis <dbl>, se <dbl>
acs %>% group_by(sex,Dx) %>% numSummary(age,EF,lang="kor")
#> # A tibble: 12 x 15 #> variable sex Dx n 평균 표준편차 중앙값 절단평균 중앙값절대편차 #> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 age Female NSTEMI 50 70.9 11.4 74.5 71.9 8.90 #> 2 age Female STEMI 84 69.1 10.4 70 70.0 10.4 #> 3 age Female Unstabl… 153 67.7 10.7 70 68.3 8.90 #> 4 age Male NSTEMI 103 61.1 11.6 59 61.3 13.3 #> 5 age Male STEMI 220 59.4 11.7 59.5 59.4 11.1 #> 6 age Male Unstabl… 247 61.4 10.6 61 61.4 10.4 #> 7 EF Female NSTEMI 45 54.8 9.10 57 55.3 9.79 #> 8 EF Female STEMI 77 52.3 10.9 55.7 53.7 9.04 #> 9 EF Female Unstabl… 118 59.4 8.76 61.1 60.8 5.49 #> 10 EF Male NSTEMI 94 55.1 9.42 58 55.9 7.12 #> 11 EF Male STEMI 195 52.4 8.90 54 52.9 8.45 #> 12 EF Male Unstabl… 194 59.1 8.67 60 60.2 5.93 #> # ... with 6 more variables: 최소값 <dbl>, 최대값 <dbl>, 범위 <dbl>, #> # 왜도 <dbl>, 첨도 <dbl>, 표준오차 <dbl>