contents provides a comprehensive description of a data frame, including summary statistics for both quantitative and categorical variables

contents(data, digits = 2, maxcat = 10, label_length = 20)

Arguments

data

a data frame

digits

number of decimal digits for statistics.

maxcat

maximum number of levels of a character/factor variable to print.

label_length

maximum length of factor level label to print. Longer labels will be truncated.

Value

a list with 6 components:

dfname

name of data frame

nrow

number of rows

ncol

number of columns

overall

data frame of overall dataset characteristics

qvars

data frame with summary statistics for quantitative variables

cvars

data frame with summary statistics for categorical variables

Details

Prints a comprehensive description of a data frame via several tables, a general summary table and tables that provide a breakdown of quantitative and categorical variables.

Examples

contents(cars74)
#> 
#> The data frame cars74 has 32 observations and 12 variables.
#> 
#> Overall
#>  pos varname type      n_unique n_miss pct_miss
#>   1  auto    character 32       0      0%      
#>   2  mpg     numeric   25       0      0%      
#>   3  cyl     ordered    3       0      0%      
#>   4  disp    numeric   27       0      0%      
#>   5  hp      numeric   22       0      0%      
#>   6  drat    numeric   22       0      0%      
#>   7  wt      numeric   29       0      0%      
#>   8  qsec    numeric   30       0      0%      
#>   9  vs      factor     2       0      0%      
#>  10  am      factor     2       0      0%      
#>  11  gear    ordered    3       0      0%      
#>  12  carb    ordered    6       0      0%      
#> 
#> Numeric Variables
#>       n   mean     sd skew   min    p25 median    p75    max
#> mpg  32  20.09   6.03 0.61 10.40  15.43  19.20  22.80  33.90
#> disp 32 230.72 123.94 0.38 71.10 120.83 196.30 326.00 472.00
#> hp   32 146.69  68.56 0.73 52.00  96.50 123.00 180.00 335.00
#> drat 32   3.60   0.53 0.27  2.76   3.08   3.70   3.92   4.93
#> wt   32   3.22   0.98 0.42  1.51   2.58   3.33   3.61   5.42
#> qsec 32  17.85   1.79 0.37 14.50  16.89  17.71  18.90  22.90
#> 
#> Categorical Variables
#>  variable level              n  pct 
#>  auto     AMC Javelin         1 0.03
#>           Cadillac Fleetwood  1 0.03
#>           Camaro Z28          1 0.03
#>           Chrysler Imperial   1 0.03
#>           Datsun 710          1 0.03
#>           Dodge Challenger    1 0.03
#>           Duster 360          1 0.03
#>           Ferrari Dino        1 0.03
#>           Fiat 128            1 0.03
#>           Fiat X1-9           1 0.03
#>           (22 more levels)   22 0.69
#>  cyl      cyl4               11 0.34
#>           cyl6                7 0.22
#>           cyl8               14 0.44
#>  vs       V-shaped           18 0.56
#>           straight           14 0.44
#>  am       automatic          19 0.59
#>           manual             13 0.41
#>  gear     gears3             15 0.47
#>           gears4             12 0.38
#>           gears5              5 0.16
#>  carb     carb1               7 0.22
#>           carb2              10 0.31
#>           carb3               3 0.09
#>           carb4              10 0.31
#>           carb6               1 0.03
#>           carb8               1 0.03