Creating a summary statistical table from a data frame

前端 未结 5 961
醉酒成梦
醉酒成梦 2020-11-27 15:47

I have the following data frame (df) of 29 observations of 5 variables:

    age   height_seca1 height_chad1 height_DL weight_alog1
1   19         1800                


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 16:00

    Adding few more options for quick Exploratory Data Analysis (EDA)

    1) skimr package:

    install.packages("skimr")
    library(skimr)
    skim(df)
    

    2) ExPanDaR package:

    install.packages("ExPanDaR")
    library(ExPanDaR)
    # export data and code to a notebook
    ExPanD(df, export_nb_option = TRUE)
    
    # open a shiny app
    ExPanD(df) 
    

    3) DescTools package:

    install.packages("DescTools")
    library(DescTools)
    Desc(df, plotit = TRUE)
    #> ------------------------------------------------------------------------------ 
    #> Describe df (data.frame):
    #> 
    #> data frame:  29 obs. of  5 variables
    #>      29 complete cases (100.0%)
    #> 
    #>   Nr  ColName       Class    NAs  Levels
    #>   1   age           integer  .          
    #>   2   height_seca1  integer  .          
    #>   3   height_chad1  integer  .          
    #>   4   height_DL     integer  .          
    #>   5   weight_alog1  integer  .          
    #> 
    #> 
    #> ------------------------------------------------------------------------------ 
    #> 1 - age (integer)
    #> 
    #>   length       n    NAs  unique     0s   mean  meanCI
    #>       29      29      0       9      0  20.41   19.16
    #>           100.0%   0.0%           0.0%          21.67
    #>                                                      
    #>      .05     .10    .25  median    .75    .90     .95
    #>    18.00   18.00  19.00   19.00  21.00  26.00   27.20
    #>                                                      
    #>    range      sd  vcoef     mad    IQR   skew    kurt
    #>    14.00    3.30   0.16    1.48   2.00   1.75    2.29
    #>                                                      
    #> 
    #>    level  freq   perc  cumfreq  cumperc
    #> 1     17     1   3.4%        1     3.4%
    #> 2     18     6  20.7%        7    24.1%
    #> 3     19    11  37.9%       18    62.1%
    #> 4     20     1   3.4%       19    65.5%
    #> 5     21     5  17.2%       24    82.8%
    #> 6     22     1   3.4%       25    86.2%
    #> 7     26     2   6.9%       27    93.1%
    #> 8     28     1   3.4%       28    96.6%
    #> 9     31     1   3.4%       29   100.0%
    #> 
    #> heap(?): remarkable frequency (37.9%) for the mode(s) (= 19)
    

    Results from Desc can be saved to a Microsoft Word docx file

    ### RDCOMClient package is needed
    install.packages("RDCOMClient", repos = "http://www.omegahat.net/R")
    # or
    devtools::install_github("omegahat/RDCOMClient")
    
    # create a new word instance and insert title and contents
    wrd <- GetNewWrd(header = TRUE)
    DescTools::Desc(df, plotit = TRUE, wrd = wrd)
    

    Created on 2020-01-17 by the reprex package (v0.3.0)

提交回复
热议问题