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(heart)
#> #> The data frame heart has 303 observations and 14 variables. #> #> Overall #> pos varname type n_unique n_miss pct_miss #> 1 age integer 41 0 0% #> 2 sex factor 2 0 0% #> 3 cp factor 4 0 0% #> 4 testbps integer 50 0 0% #> 5 chol integer 152 0 0% #> 6 fbs integer 2 0 0% #> 7 restecg factor 3 0 0% #> 8 thalach integer 91 0 0% #> 9 exang integer 2 0 0% #> 10 oldpeak numeric 40 0 0% #> 11 slope factor 3 0 0% #> 12 ca numeric 5 4 1% #> 13 thal factor 4 2 1% #> 14 disease factor 2 0 0% #> #> Numeric Variables #> n mean sd skew min p25 median p75 max #> age 303 54.44 9.04 -0.21 29 48.0 56.0 61.0 77.0 #> testbps 303 131.69 17.60 0.70 94 120.0 130.0 140.0 200.0 #> chol 303 246.69 51.78 1.12 126 211.0 241.0 275.0 564.0 #> fbs 303 0.15 0.36 1.97 0 0.0 0.0 0.0 1.0 #> thalach 303 149.61 22.88 -0.53 71 133.5 153.0 166.0 202.0 #> exang 303 0.33 0.47 0.74 0 0.0 0.0 1.0 1.0 #> oldpeak 303 1.04 1.16 1.26 0 0.0 0.8 1.6 6.2 #> ca 299 0.67 0.94 1.18 0 0.0 0.0 1.0 3.0 #> #> Categorical Variables #> variable level n pct #> sex female 97 0.32 #> male 206 0.68 #> cp typical angina 23 0.08 #> atypical angina 50 0.17 #> non-anginal pain 86 0.28 #> asymptomatic 144 0.48 #> restecg normal 151 0.50 #> ST-T wave abnormalit 4 0.01 #> left ventricular hyp 148 0.49 #> slope upsloping 142 0.47 #> flat 140 0.46 #> downsloping 21 0.07 #> thal normal 166 0.55 #> fixed defect 18 0.06 #> reversable defect 117 0.39 #> disease no 164 0.54 #> yes 139 0.46