Everyone has a funcion like this, str, glimpse, glance etc. This one is specifically designed for use with finalfit language. It is different in dividing variables by numeric vs factor.

ff_glimpse(.data, dependent = NULL, explanatory = NULL, digits = 1,
  levels_cut = 5)

finalfit_glimpse(.data, dependent = NULL, explanatory = NULL,
  digits = 1, levels_cut = 5)

Arguments

.data

Dataframe.

dependent

Optional character vector: name(s) of depdendent variable(s).

explanatory

Optional character vector: name(s) of explanatory variable(s).

digits

Significant digits for continuous variable summaries

levels_cut

Max number of factor levels to include in factor levels summary (in order to avoid the long printing of variables with many factors).

Value

Dataframe on summary data.

Examples

library(finalfit) dependent = 'mort_5yr' explanatory = c("age", "nodes", "age.factor", "extent.factor", "perfor.factor") colon_s %>% finalfit_glimpse(dependent, explanatory)
#> Continuous #> label var_type n missing_n missing_percent mean sd min #> age Age (years) <S3: labelled> 929 0 0.0 59.8 11.9 18.0 #> nodes nodes <dbl> 911 18 1.9 3.7 3.6 0.0 #> quartile_25 median quartile_75 max #> age 53.0 61.0 69.0 85.0 #> nodes 1.0 2.0 5.0 33.0 #> #> Categorical #> label var_type n missing_n missing_percent levels_n #> perfor.factor Perforation <fct> 929 0 0.0 2 #> extent.factor Extent of spread <fct> 929 0 0.0 4 #> age.factor Age <fct> 929 0 0.0 3 #> mort_5yr Mortality 5 year <fct> 915 14 1.5 2 #> levels #> perfor.factor "No", "Yes" #> extent.factor "Submucosa", "Muscle", "Serosa", "Adjacent structures" #> age.factor "<40 years", "40-59 years", "60+ years" #> mort_5yr "Alive", "Died", "(Missing)" #> levels_count levels_percent #> perfor.factor 902, 27 97.1, 2.9 #> extent.factor 21, 106, 759, 43 2.3, 11.4, 81.7, 4.6 #> age.factor 70, 344, 515 7.5, 37.0, 55.4 #> mort_5yr 511, 404, 14 55.0, 43.5, 1.5