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)    <dbl> 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
#> mort_5yr      Mortality 5 year    <fct> 915        14             1.5        2
#> age.factor                 Age    <fct> 929         0             0.0        3
#> extent.factor Extent of spread    <fct> 929         0             0.0        4
#> perfor.factor      Perforation    <fct> 929         0             0.0        2
#>                                                                            levels
#> mort_5yr                                             "Alive", "Died", "(Missing)"
#> age.factor                   "<40 years", "40-59 years", "60+ years", "(Missing)"
#> extent.factor "Submucosa", "Muscle", "Serosa", "Adjacent structures", "(Missing)"
#> perfor.factor                                            "No", "Yes", "(Missing)"
#>                   levels_count         levels_percent
#> mort_5yr          511, 404, 14       55.0, 43.5,  1.5
#> age.factor        70, 344, 515        7.5, 37.0, 55.4
#> extent.factor 21, 106, 759, 43  2.3, 11.4, 81.7,  4.6
#> perfor.factor          902, 27             97.1,  2.9
#>