numSummary: Numerical Summary

Description Usage Arguments Functions Examples

View source: R/numSummary.R

Description

Numerical Summary

Usage

1
2
3
4
5
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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
require(moonBook)
require(magrittr)
require(dplyr)
require(rrtable)
require(webr)
require(tibble)
numSummary(acs)
numSummary(acs$age)
numSummary(acs,age,EF)
acs %>% group_by(sex) %>% numSummary(age,BMI)
acs %>% group_by(sex) %>% select(age) %>% numSummary
acs %>% group_by(sex) %>% select(age,EF) %>% numSummary
acs %>% group_by(sex,Dx) %>% select(age,EF) %>% numSummary
acs %>% group_by(sex,Dx) %>% select(age) %>% numSummary
#acs %>% group_by(sex,Dx) %>% numSummary(age,EF,lang="kor")

Example output

Loading required package: moonBook
Loading required package: magrittr
Loading required package: dplyr

Attaching package:dplyrThe following objects are masked frompackage:stats:

    filter, lag

The following objects are masked frompackage:base:

    intersect, setdiff, setequal, union

Loading required package: rrtable
Welcome to rrtable package
Register inputHandler for chooserInput
Loading required package: tibble
# A tibble: 9 x 13
  vars      n  mean    sd median trimmed   mad   min   max range   skew kurtosis
  <chr> <dbl> <dbl> <dbl>  <dbl>   <dbl> <dbl> <dbl> <dbl> <dbl>  <dbl>    <dbl>
1 age     857  63.3 11.7    64      63.6 13.3   28    91    63   -0.175  -0.566 
2 EF      723  55.8  9.62   58.1    56.8  7.86  18    79    61   -0.978   1.11  
3 heig764 163.   9.08  165     164.   7.41 130   185    55   -0.440  -0.0145
4 weig766  64.8 11.4    65      64.5 10.4   30   112    82    0.336   0.444 
5 BMI     764  24.3  3.35   24.2    24.2  3.01  15.6  41.4  25.8  0.668   2.12  
6 TC      834 185.  47.8   183     184.  43.0   25   493   468    0.737   3.77  
7 LDLC    833 117.  41.1   114     115.  40.0   15   366   351    0.787   2.33  
8 HDLC    834  38.2 11.1    38      38.0 10.4    4    89    85    0.366   1.46  
9 TG      842 125.  90.9   106.    111.  60.0   11   877   866    3.02   14.9   
# … with 1 more variable: se <dbl>
# A tibble: 1 x 12
      n  mean    sd median trimmed   mad   min   max range   skew kurtosis    se
  <dbl> <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 0.400
# A tibble: 2 x 13
  vars      n  mean    sd median trimmed   mad   min   max range   skew kurtosis
  <chr> <dbl> <dbl> <dbl>  <dbl>   <dbl> <dbl> <dbl> <dbl> <dbl>  <dbl>    <dbl>
1 age     857  63.3 11.7    64      63.6 13.3     28    91    63 -0.175   -0.566
2 EF      723  55.8  9.62   58.1    56.8  7.86    18    79    61 -0.978    1.11 
# … with 1 more variable: se <dbl>
# A tibble: 4 x 14
# Groups:   sex [2]
  sex   vars      n  mean    sd median trimmed   mad   min   max range    skew
  <chr> <chr> <dbl> <dbl> <dbl>  <dbl>   <dbl> <dbl> <dbl> <dbl> <dbl>   <dbl>
1 Male  age     570  60.6 11.2    61      60.6 11.9   28    91    63   -0.0148
2 Male  BMI     509  24.3  3.24   24.2    24.2  2.98  16.3  41.4  25.1  0.616 
3 Femaage     287  68.7 10.7    70      69.4 10.4   39    90    51   -0.593 
4 FemaBMI     255  24.2  3.56   24.0    24.1  3.13  15.6  41.2  25.6  0.751 
# … with 2 more variables: kurtosis <dbl>, se <dbl>
Warning message:
`cols` is now required when using unnest().
Please use `cols = c(summary)` 
Adding missing grouping variables: `sex`
# A tibble: 2 x 13
# Groups:   sex [2]
  sex       n  mean    sd median trimmed   mad   min   max range    skew
  <chr> <dbl> <dbl> <dbl>  <dbl>   <dbl> <dbl> <dbl> <dbl> <dbl>   <dbl>
1 Male    570  60.6  11.2     61    60.6  11.9    28    91    63 -0.0148
2 Fema287  68.7  10.7     70    69.4  10.4    39    90    51 -0.593 
# … with 2 more variables: kurtosis <dbl>, se <dbl>
Warning message:
`cols` is now required when using unnest().
Please use `cols = c(summary)` 
Adding missing grouping variables: `sex`
# A tibble: 4 x 14
# Groups:   sex [2]
  sex   vars      n  mean    sd median trimmed   mad   min   max range    skew
  <chr> <chr> <dbl> <dbl> <dbl>  <dbl>   <dbl> <dbl> <dbl> <dbl> <dbl>   <dbl>
1 Male  age     570  60.6 11.2    61      60.6 11.9   28      91  63   -0.0148
2 Male  EF      483  55.6  9.40   57.3    56.4  8.01  18      79  61   -0.789 
3 Femaage     287  68.7 10.7    70      69.4 10.4   39      90  51   -0.593 
4 FemaEF      240  56.3 10.1    59.2    57.6  7.19  18.4    75  56.6 -1.30  
# … with 2 more variables: kurtosis <dbl>, se <dbl>
Warning message:
`cols` is now required when using unnest().
Please use `cols = c(summary)` 
Adding missing grouping variables: `sex`, `Dx`
# A tibble: 12 x 15
# Groups:   sex, Dx [6]
   sex   Dx    vars      n  mean    sd median trimmed   mad   min   max range
   <chr> <chr> <chr> <dbl> <dbl> <dbl>  <dbl>   <dbl> <dbl> <dbl> <dbl> <dbl>
 1 Male  STEMI age     220  59.4 11.7    59.5    59.4 11.1   30    86    56  
 2 Male  STEMI EF      195  52.4  8.90   54      52.9  8.45  18    73.6  55.6
 3 FemaSTEMI age      84  69.1 10.4    70      70.0 10.4   42    89    47  
 4 FemaSTEMI EF       77  52.3 10.9    55.7    53.7  9.04  18.4  67.1  48.7
 5 Male  NSTEage     103  61.1 11.6    59      61.3 13.3   28    85    57  
 6 Male  NSTEEF       94  55.1  9.42   58      55.9  7.12  21.8  74    52.2
 7 FemaUnstage     153  67.7 10.7    70      68.3  8.90  39    90    51  
 8 FemaUnstEF      118  59.4  8.76   61.1    60.8  5.49  22    71.9  49.9
 9 Male  Unstage     247  61.4 10.6    61      61.4 10.4   35    91    56  
10 Male  UnstEF      194  59.1  8.67   60      60.2  5.93  24.7  79    54.3
11 FemaNSTEage      50  70.9 11.4    74.5    71.9  8.90  42    88    46  
12 FemaNSTEEF       45  54.8  9.10   57      55.3  9.79  36.8  75    38.2
# … with 3 more variables: skew <dbl>, kurtosis <dbl>, se <dbl>
Warning message:
`cols` is now required when using unnest().
Please use `cols = c(summary)` 
Adding missing grouping variables: `sex`, `Dx`
# A tibble: 6 x 14
# Groups:   sex, Dx [6]
  sex   Dx        n  mean    sd median trimmed   mad   min   max range     skew
  <chr> <chr> <dbl> <dbl> <dbl>  <dbl>   <dbl> <dbl> <dbl> <dbl> <dbl>    <dbl>
1 Male  STEMI   220  59.4  11.7   59.5    59.4 11.1     30    86    56  0.00433
2 FemaSTEMI    84  69.1  10.4   70      70.0 10.4     42    89    47 -0.654  
3 Male  NSTE103  61.1  11.6   59      61.3 13.3     28    85    57 -0.110  
4 FemaUnst153  67.7  10.7   70      68.3  8.90    39    90    51 -0.540  
5 Male  Unst247  61.4  10.6   61      61.4 10.4     35    91    56  0.0710 
6 FemaNSTE50  70.9  11.4   74.5    71.9  8.90    42    88    46 -0.721  
# … with 2 more variables: kurtosis <dbl>, se <dbl>
Warning message:
`cols` is now required when using unnest().
Please use `cols = c(summary)` 

webr documentation built on March 26, 2020, 6:22 p.m.