Skip to contents

Make household travel survey summaries-- runs hts_prep_variable and hts_summary

Usage

hts_summary_wrapper(
  summarize_var = NULL,
  summarize_by = NULL,
  variables_dt = variable_list,
  vals_df = value_labels,
  data = list(hh = hh, person = person, day = day, trip = trip, vehicle = vehicle),
  id_cols = c("hh_id", "person_id", "day_id", "trip_id", "vehicle_id"),
  weighted = TRUE,
  wt_cols = c("hh_weight", "person_weight", "day_weight", "trip_weight", "hh_weight"),
  trip_name = "trip",
  day_name = "day",
  strataname = NULL,
  se = FALSE,
  checkbox_valname = "value",
  checkbox_yesval = 1,
  value_label_colname = "label",
  remove_outliers = TRUE,
  threshold = 0.975,
  remove_missing = TRUE,
  not_imputable = -1,
  missing_values = c("Missing Response", "995")
)

Arguments

summarize_var

Name of the variable to summarize. Default is NULL

summarize_by

Name of the variable to summarize the summarize_var by. Default is NULL.

variables_dt

List of variable locations and descriptions in data.table format.

vals_df

A dataframe of variable labels (i.e., factor levels and labels) with the format as specified below. Passed to factorize_column function.

data

List of household, person, vehicle, day, and trip tables in data.table format.

id_cols

name of unique identifier for each table in hts_data

weighted

Whether the data is weighted. Default is TRUE.

wt_cols

weight name for each table in hts_data

trip_name

Name of the trip dataset in hts_data.

day_name

Name of the day dataset in hts_data.

strataname

Name of strata name to bring in. Default is NULL.

se

Whether to calculate standard error. Default is FALSE. Will be set to FALSE if weighted is FALSE.

checkbox_valname

Name of the column with the checkbox value. Default is 'value'. Must be provided if summarize_var is a checkbox variable.

checkbox_yesval

Value of checkbox_valname that indicates it was selected. Default is 1. Must be provided if summarize_var is a checkbox variable.

value_label_colname

The name of the value label column in vals_df. Default is 'value_label'

remove_outliers

Whether to remove outliers for numeric variable. Default is TRUE.

threshold

Threshold to define outliers. Default is 0.975.

remove_missing

Whether to remove missing values from the summary. Default is TRUE.

not_imputable

Value representing 'Not imputable' to remove. Default is -1.

missing_values

Missing values to remove. Default is 995.

Value

A list containing (if applicable) categorical and numeric summaries of the specified variable(s), as well as sample sizes and whether or not the summarized variable is a shared checkbox variable. To access the categorical/numeric df use output$summary. To access the weighted df use output$summary$wtd, and output$summary$unwtd for the unweighted df. To access the weight name use output$summary$weight_name. To access sample sizes use output$n_ls. To access weighted and unweighted sample sizes respectively, use output$n_ls$wtd and output$n_ls$unwtd.

Examples



hts_summary_wrapper(
summarize_var = 'employment',
summarize_by = 'income_detailed')
#> $cat
#> $cat$n_ls
#> $cat$n_ls$unwtd
#> $cat$n_ls$unwtd$`Count of unique hh_id`
#> [1] 843
#> 
#> $cat$n_ls$unwtd$`Count of unique person_id`
#> [1] 1770
#> 
#> 
#> $cat$n_ls$wtd
#> Sum of person_weight 
#>               902225 
#> 
#> 
#> $cat$summary
#> $cat$summary$unwtd
#>          income_detailed
#>  1:        Under $10,000
#>  2:        Under $10,000
#>  3:        Under $10,000
#>  4:        Under $10,000
#>  5:        Under $10,000
#>  6:      $10,000-$24,999
#>  7:      $10,000-$24,999
#>  8:      $10,000-$24,999
#>  9:      $10,000-$24,999
#> 10:      $10,000-$24,999
#> 11:      $10,000-$24,999
#> 12:      $25,000-$34,999
#> 13:      $25,000-$34,999
#> 14:      $25,000-$34,999
#> 15:      $25,000-$34,999
#> 16:      $25,000-$34,999
#> 17:      $25,000-$34,999
#> 18:      $35,000-$49,999
#> 19:      $35,000-$49,999
#> 20:      $35,000-$49,999
#> 21:      $35,000-$49,999
#> 22:      $35,000-$49,999
#> 23:      $35,000-$49,999
#> 24:      $35,000-$49,999
#> 25:      $50,000-$74,999
#> 26:      $50,000-$74,999
#> 27:      $50,000-$74,999
#> 28:      $50,000-$74,999
#> 29:      $50,000-$74,999
#> 30:      $50,000-$74,999
#> 31:      $75,000-$99,999
#> 32:      $75,000-$99,999
#> 33:      $75,000-$99,999
#> 34:      $75,000-$99,999
#> 35:      $75,000-$99,999
#> 36:      $75,000-$99,999
#> 37:      $75,000-$99,999
#> 38:    $100,000-$149,999
#> 39:    $100,000-$149,999
#> 40:    $100,000-$149,999
#> 41:    $100,000-$149,999
#> 42:    $100,000-$149,999
#> 43:    $100,000-$149,999
#> 44:    $100,000-$149,999
#> 45:    $150,000-$199,999
#> 46:    $150,000-$199,999
#> 47:    $150,000-$199,999
#> 48:    $150,000-$199,999
#> 49:    $150,000-$199,999
#> 50:    $150,000-$199,999
#> 51:    $200,000-$249,999
#> 52:    $200,000-$249,999
#> 53:    $200,000-$249,999
#> 54:    $200,000-$249,999
#> 55:    $200,000-$249,999
#> 56:    $200,000-$249,999
#> 57:    $200,000-$249,999
#> 58:     $250,000 or more
#> 59:     $250,000 or more
#> 60:     $250,000 or more
#> 61:     $250,000 or more
#> 62:     $250,000 or more
#> 63:     $250,000 or more
#> 64:     $250,000 or more
#> 65: Prefer not to answer
#> 66: Prefer not to answer
#> 67: Prefer not to answer
#> 68: Prefer not to answer
#> 69: Prefer not to answer
#> 70: Prefer not to answer
#> 71: Prefer not to answer
#>          income_detailed
#>                                                                              employment
#>  1:                                           Employed full-time (35+ hours/week, paid)
#>  2:                                 Employed part-time (fewer than 35 hours/week, paid)
#>  3:                                                                       Self-employed
#>  4: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#>  5:                                                     Unemployed and looking for work
#>  6:                                           Employed full-time (35+ hours/week, paid)
#>  7:                                 Employed part-time (fewer than 35 hours/week, paid)
#>  8:                                                                       Self-employed
#>  9: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 10:                                                     Unemployed and looking for work
#> 11:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 12:                                           Employed full-time (35+ hours/week, paid)
#> 13:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 14:                                                                       Self-employed
#> 15: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 16:                                                     Unemployed and looking for work
#> 17:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 18:                                           Employed full-time (35+ hours/week, paid)
#> 19:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 20:                                                                       Self-employed
#> 21: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 22:                                                     Unemployed and looking for work
#> 23:                                                          Unpaid volunteer or intern
#> 24:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 25:                                           Employed full-time (35+ hours/week, paid)
#> 26:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 27:                                                                       Self-employed
#> 28: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 29:                                                     Unemployed and looking for work
#> 30:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 31:                                           Employed full-time (35+ hours/week, paid)
#> 32:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 33:                                                                       Self-employed
#> 34: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 35:                                                     Unemployed and looking for work
#> 36:                                                          Unpaid volunteer or intern
#> 37:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 38:                                           Employed full-time (35+ hours/week, paid)
#> 39:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 40:                                                                       Self-employed
#> 41: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 42:                                                     Unemployed and looking for work
#> 43:                                                          Unpaid volunteer or intern
#> 44:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 45:                                           Employed full-time (35+ hours/week, paid)
#> 46:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 47:                                                                       Self-employed
#> 48: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 49:                                                     Unemployed and looking for work
#> 50:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 51:                                           Employed full-time (35+ hours/week, paid)
#> 52:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 53:                                                                       Self-employed
#> 54: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 55:                                                     Unemployed and looking for work
#> 56:                                                          Unpaid volunteer or intern
#> 57:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 58:                                           Employed full-time (35+ hours/week, paid)
#> 59:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 60:                                                                       Self-employed
#> 61: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 62:                                                     Unemployed and looking for work
#> 63:                                                          Unpaid volunteer or intern
#> 64:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 65:                                           Employed full-time (35+ hours/week, paid)
#> 66:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 67:                                                                       Self-employed
#> 68: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 69:                                                     Unemployed and looking for work
#> 70:                                                          Unpaid volunteer or intern
#> 71:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#>                                                                              employment
#>     count        prop
#>  1:    35 0.593220339
#>  2:     2 0.033898305
#>  3:     8 0.135593220
#>  4:    11 0.186440678
#>  5:     3 0.050847458
#>  6:    54 0.529411765
#>  7:    11 0.107843137
#>  8:     6 0.058823529
#>  9:    22 0.215686275
#> 10:     6 0.058823529
#> 11:     3 0.029411765
#> 12:    40 0.487804878
#> 13:     7 0.085365854
#> 14:     5 0.060975610
#> 15:    28 0.341463415
#> 16:     1 0.012195122
#> 17:     1 0.012195122
#> 18:    46 0.464646465
#> 19:     7 0.070707071
#> 20:     6 0.060606061
#> 21:    35 0.353535354
#> 22:     3 0.030303030
#> 23:     1 0.010101010
#> 24:     1 0.010101010
#> 25:   121 0.523809524
#> 26:    21 0.090909091
#> 27:     8 0.034632035
#> 28:    68 0.294372294
#> 29:    12 0.051948052
#> 30:     1 0.004329004
#> 31:    85 0.442708333
#> 32:    21 0.109375000
#> 33:    13 0.067708333
#> 34:    58 0.302083333
#> 35:    11 0.057291667
#> 36:     2 0.010416667
#> 37:     2 0.010416667
#> 38:   153 0.506622517
#> 39:    28 0.092715232
#> 40:    20 0.066225166
#> 41:    80 0.264900662
#> 42:    15 0.049668874
#> 43:     4 0.013245033
#> 44:     2 0.006622517
#> 45:    95 0.536723164
#> 46:    21 0.118644068
#> 47:    12 0.067796610
#> 48:    42 0.237288136
#> 49:     6 0.033898305
#> 50:     1 0.005649718
#> 51:    66 0.507692308
#> 52:     8 0.061538462
#> 53:     7 0.053846154
#> 54:    38 0.292307692
#> 55:     8 0.061538462
#> 56:     2 0.015384615
#> 57:     1 0.007692308
#> 58:    81 0.500000000
#> 59:     8 0.049382716
#> 60:    11 0.067901235
#> 61:    50 0.308641975
#> 62:     8 0.049382716
#> 63:     3 0.018518519
#> 64:     1 0.006172840
#> 65:   121 0.517094017
#> 66:    17 0.072649573
#> 67:    14 0.059829060
#> 68:    69 0.294871795
#> 69:     8 0.034188034
#> 70:     2 0.008547009
#> 71:     3 0.012820513
#>     count        prop
#> 
#> $cat$summary$wtd
#>          income_detailed
#>  1:        Under $10,000
#>  2:        Under $10,000
#>  3:        Under $10,000
#>  4:        Under $10,000
#>  5:        Under $10,000
#>  6:      $10,000-$24,999
#>  7:      $10,000-$24,999
#>  8:      $10,000-$24,999
#>  9:      $10,000-$24,999
#> 10:      $10,000-$24,999
#> 11:      $10,000-$24,999
#> 12:      $25,000-$34,999
#> 13:      $25,000-$34,999
#> 14:      $25,000-$34,999
#> 15:      $25,000-$34,999
#> 16:      $25,000-$34,999
#> 17:      $25,000-$34,999
#> 18:      $35,000-$49,999
#> 19:      $35,000-$49,999
#> 20:      $35,000-$49,999
#> 21:      $35,000-$49,999
#> 22:      $35,000-$49,999
#> 23:      $35,000-$49,999
#> 24:      $35,000-$49,999
#> 25:      $50,000-$74,999
#> 26:      $50,000-$74,999
#> 27:      $50,000-$74,999
#> 28:      $50,000-$74,999
#> 29:      $50,000-$74,999
#> 30:      $50,000-$74,999
#> 31:      $75,000-$99,999
#> 32:      $75,000-$99,999
#> 33:      $75,000-$99,999
#> 34:      $75,000-$99,999
#> 35:      $75,000-$99,999
#> 36:      $75,000-$99,999
#> 37:      $75,000-$99,999
#> 38:    $100,000-$149,999
#> 39:    $100,000-$149,999
#> 40:    $100,000-$149,999
#> 41:    $100,000-$149,999
#> 42:    $100,000-$149,999
#> 43:    $100,000-$149,999
#> 44:    $100,000-$149,999
#> 45:    $150,000-$199,999
#> 46:    $150,000-$199,999
#> 47:    $150,000-$199,999
#> 48:    $150,000-$199,999
#> 49:    $150,000-$199,999
#> 50:    $150,000-$199,999
#> 51:    $200,000-$249,999
#> 52:    $200,000-$249,999
#> 53:    $200,000-$249,999
#> 54:    $200,000-$249,999
#> 55:    $200,000-$249,999
#> 56:    $200,000-$249,999
#> 57:    $200,000-$249,999
#> 58:     $250,000 or more
#> 59:     $250,000 or more
#> 60:     $250,000 or more
#> 61:     $250,000 or more
#> 62:     $250,000 or more
#> 63:     $250,000 or more
#> 64:     $250,000 or more
#> 65: Prefer not to answer
#> 66: Prefer not to answer
#> 67: Prefer not to answer
#> 68: Prefer not to answer
#> 69: Prefer not to answer
#> 70: Prefer not to answer
#> 71: Prefer not to answer
#>          income_detailed
#>                                                                              employment
#>  1:                                           Employed full-time (35+ hours/week, paid)
#>  2:                                 Employed part-time (fewer than 35 hours/week, paid)
#>  3:                                                                       Self-employed
#>  4: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#>  5:                                                     Unemployed and looking for work
#>  6:                                           Employed full-time (35+ hours/week, paid)
#>  7:                                 Employed part-time (fewer than 35 hours/week, paid)
#>  8:                                                                       Self-employed
#>  9: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 10:                                                     Unemployed and looking for work
#> 11:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 12:                                           Employed full-time (35+ hours/week, paid)
#> 13:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 14:                                                                       Self-employed
#> 15: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 16:                                                     Unemployed and looking for work
#> 17:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 18:                                           Employed full-time (35+ hours/week, paid)
#> 19:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 20:                                                                       Self-employed
#> 21: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 22:                                                     Unemployed and looking for work
#> 23:                                                          Unpaid volunteer or intern
#> 24:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 25:                                           Employed full-time (35+ hours/week, paid)
#> 26:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 27:                                                                       Self-employed
#> 28: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 29:                                                     Unemployed and looking for work
#> 30:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 31:                                           Employed full-time (35+ hours/week, paid)
#> 32:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 33:                                                                       Self-employed
#> 34: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 35:                                                     Unemployed and looking for work
#> 36:                                                          Unpaid volunteer or intern
#> 37:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 38:                                           Employed full-time (35+ hours/week, paid)
#> 39:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 40:                                                                       Self-employed
#> 41: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 42:                                                     Unemployed and looking for work
#> 43:                                                          Unpaid volunteer or intern
#> 44:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 45:                                           Employed full-time (35+ hours/week, paid)
#> 46:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 47:                                                                       Self-employed
#> 48: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 49:                                                     Unemployed and looking for work
#> 50:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 51:                                           Employed full-time (35+ hours/week, paid)
#> 52:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 53:                                                                       Self-employed
#> 54: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 55:                                                     Unemployed and looking for work
#> 56:                                                          Unpaid volunteer or intern
#> 57:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 58:                                           Employed full-time (35+ hours/week, paid)
#> 59:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 60:                                                                       Self-employed
#> 61: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 62:                                                     Unemployed and looking for work
#> 63:                                                          Unpaid volunteer or intern
#> 64:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#> 65:                                           Employed full-time (35+ hours/week, paid)
#> 66:                                 Employed part-time (fewer than 35 hours/week, paid)
#> 67:                                                                       Self-employed
#> 68: Not employed and not looking for work (e.g., retired, stay-at-home parent, student)
#> 69:                                                     Unemployed and looking for work
#> 70:                                                          Unpaid volunteer or intern
#> 71:               Employed, but not currently working (e.g., on leave, furloughed 100%)
#>                                                                              employment
#>     count        prop   est
#>  1:    35 0.594403345 16632
#>  2:     2 0.018047961   505
#>  3:     8 0.153103892  4284
#>  4:    11 0.187698796  5252
#>  5:     3 0.046746006  1308
#>  6:    54 0.536837376 27485
#>  7:    11 0.120004688  6144
#>  8:     6 0.063986874  3276
#>  9:    22 0.193972421  9931
#> 10:     6 0.057033478  2920
#> 11:     3 0.028165163  1442
#> 12:    40 0.506029839 21232
#> 13:     7 0.087396921  3667
#> 14:     5 0.060012393  2518
#> 15:    28 0.335120835 14061
#> 16:     1 0.001001001    42
#> 17:     1 0.010439010   438
#> 18:    46 0.510216731 25519
#> 19:     7 0.056641875  2833
#> 20:     6 0.066958573  3349
#> 21:    35 0.288747601 14442
#> 22:     3 0.053722809  2687
#> 23:     1 0.017654351   883
#> 24:     1 0.006058061   303
#> 25:   121 0.510996349 60457
#> 26:    21 0.096938603 11469
#> 27:     8 0.040621408  4806
#> 28:    68 0.302851782 35831
#> 29:    12 0.043748732  5176
#> 30:     1 0.004843127   573
#> 31:    85 0.446295073 46624
#> 32:    21 0.095904048 10019
#> 33:    13 0.056466512  5899
#> 34:    58 0.325876576 34044
#> 35:    11 0.059577482  6224
#> 36:     2 0.010874039  1136
#> 37:     2 0.005006270   523
#> 38:   153 0.508655852 76570
#> 39:    28 0.107577026 16194
#> 40:    20 0.061208763  9214
#> 41:    80 0.247020607 37185
#> 42:    15 0.052101186  7843
#> 43:     4 0.018122152  2728
#> 44:     2 0.005314414   800
#> 45:    95 0.509502642 44931
#> 46:    21 0.110607126  9754
#> 47:    12 0.087134012  7684
#> 48:    42 0.256514640 22621
#> 49:     6 0.026750278  2359
#> 50:     1 0.009491302   837
#> 51:    66 0.498546078 31718
#> 52:     8 0.058832775  3743
#> 53:     7 0.038430707  2445
#> 54:    38 0.304616400 19380
#> 55:     8 0.069379607  4414
#> 56:     2 0.014680687   934
#> 57:     1 0.015513745   987
#> 58:    81 0.506568977 42452
#> 59:     8 0.050523251  4234
#> 60:    11 0.089507536  7501
#> 61:    50 0.267961767 22456
#> 62:     8 0.059019367  4946
#> 63:     3 0.019462310  1631
#> 64:     1 0.006956792   583
#> 65:   121 0.475009620 58021
#> 66:    17 0.088311625 10787
#> 67:    14 0.077938877  9520
#> 68:    69 0.279106323 34092
#> 69:     8 0.048032289  5867
#> 70:     2 0.009783294  1195
#> 71:     3 0.021817973  2665
#>     count        prop   est
#> 
#> $cat$summary$weight_name
#> [1] "person_weight"
#> 
#> 
#> $cat$summarize_var
#> [1] "employment"
#> 
#> $cat$summarize_by
#> [1] "income_detailed"
#> 
#> 
#> $num
#> NULL
#> 


hts_summary_wrapper(
summarize_var = 'race',
summarize_by = c('age', 'employment')
)
#> $cat
#> $cat$n_ls
#> $cat$n_ls$unwtd
#> $cat$n_ls$unwtd$`Count of unique hh_id`
#> [1] 843
#> 
#> $cat$n_ls$unwtd$`Count of unique person_id`
#> [1] 1770
#> 
#> 
#> $cat$n_ls$wtd
#> Sum of person_weight 
#>              6315575 
#> 
#> 
#> $cat$summary
#> $cat$summary$unwtd
#>              age                                employment
#>   1:     Under 5 Employed full-time (35+ hours/week, paid)
#>   2:     Under 5 Employed full-time (35+ hours/week, paid)
#>   3:     Under 5 Employed full-time (35+ hours/week, paid)
#>   4:     Under 5 Employed full-time (35+ hours/week, paid)
#>   5:     Under 5 Employed full-time (35+ hours/week, paid)
#>  ---                                                      
#> 427: 85 or older           Unemployed and looking for work
#> 428: 85 or older           Unemployed and looking for work
#> 429: 85 or older           Unemployed and looking for work
#> 430: 85 or older           Unemployed and looking for work
#> 431: 85 or older           Unemployed and looking for work
#>                                           race count      prop
#>   1:                 African American or Black    19 0.2794118
#>   2:          American Indian or Alaska Native    18 0.2647059
#>   3:                                     Asian    21 0.3088235
#>   4: Native Hawaiian or other Pacific Islander    20 0.2941176
#>   5:                                     White    19 0.2794118
#>  ---                                                          
#> 427:          American Indian or Alaska Native     2 0.2857143
#> 428:                                     Asian     2 0.2857143
#> 429: Native Hawaiian or other Pacific Islander     2 0.2857143
#> 430:                                     White     2 0.2857143
#> 431:                      Prefer not to answer     3 0.4285714
#> 
#> $cat$summary$wtd
#>              age                                employment
#>   1:     Under 5 Employed full-time (35+ hours/week, paid)
#>   2:     Under 5 Employed full-time (35+ hours/week, paid)
#>   3:     Under 5 Employed full-time (35+ hours/week, paid)
#>   4:     Under 5 Employed full-time (35+ hours/week, paid)
#>   5:     Under 5 Employed full-time (35+ hours/week, paid)
#>  ---                                                      
#> 427: 85 or older           Unemployed and looking for work
#> 428: 85 or older           Unemployed and looking for work
#> 429: 85 or older           Unemployed and looking for work
#> 430: 85 or older           Unemployed and looking for work
#> 431: 85 or older           Unemployed and looking for work
#>                                           race count      prop  est wtd_group_n
#>   1:                 African American or Black    19 0.2678266 9390       35060
#>   2:          American Indian or Alaska Native    18 0.2697946 9459       35060
#>   3:                                     Asian    21 0.2495722 8750       35060
#>   4: Native Hawaiian or other Pacific Islander    20 0.2790645 9784       35060
#>   5:                                     White    19 0.2383058 8355       35060
#>  ---                                                                           
#> 427:          American Indian or Alaska Native     2 0.2094723  774        3695
#> 428:                                     Asian     2 0.2094723  774        3695
#> 429: Native Hawaiian or other Pacific Islander     2 0.3161028 1168        3695
#> 430:                      Prefer not to answer     3 0.5412720 2000        3695
#> 431:                                     White     2 0.3918809 1448        3695
#> 
#> $cat$summary$weight_name
#> [1] "person_weight"
#> 
#> 
#> $cat$summarize_var
#> [1] "race"
#> 
#> $cat$summarize_by
#> [1] "age"        "employment"
#> 
#> 
#> $num
#> NULL
#> 

hts_summary_wrapper(
summarize_var = 'num_trips',
summarize_by = 'age')
#> Warning: 104 outliers were removed based on the threshold of 0.975.
#> $cat
#> $cat$n_ls
#> $cat$n_ls$unwtd
#> $cat$n_ls$unwtd$`Count of unique hh_id`
#> [1] 821
#> 
#> $cat$n_ls$unwtd$`Count of unique person_id`
#> [1] 1743
#> 
#> $cat$n_ls$unwtd$`Count of unique day_id`
#> [1] 4021
#> 
#> 
#> $cat$n_ls$wtd
#> Sum of day_weight 
#>           2073324 
#> 
#> 
#> $cat$summary
#> $cat$summary$unwtd
#>             age  num_trips count        prop
#>  1:     Under 5  Exactly 0     9 0.024861878
#>  2:     Under 5        0-7   256 0.707182320
#>  3:     Under 5       7-14    55 0.151933702
#>  4:     Under 5      14-21    16 0.044198895
#>  5:     Under 5      21-28    14 0.038674033
#>  6:     Under 5      28-34     2 0.005524862
#>  7:     Under 5 34 or more    10 0.027624309
#>  8:        5-11  Exactly 0     4 0.013698630
#>  9:        5-11        0-7   216 0.739726027
#> 10:        5-11       7-14    40 0.136986301
#> 11:        5-11      14-21    15 0.051369863
#> 12:        5-11      21-28     7 0.023972603
#> 13:        5-11      28-34     1 0.003424658
#> 14:        5-11 34 or more     9 0.030821918
#> 15:       12-15  Exactly 0     6 0.019672131
#> 16:       12-15        0-7   227 0.744262295
#> 17:       12-15       7-14    42 0.137704918
#> 18:       12-15      14-21    14 0.045901639
#> 19:       12-15      21-28     6 0.019672131
#> 20:       12-15      28-34     4 0.013114754
#> 21:       12-15 34 or more     6 0.019672131
#> 22:       16-17  Exactly 0     9 0.025069638
#> 23:       16-17        0-7   258 0.718662953
#> 24:       16-17       7-14    42 0.116991643
#> 25:       16-17      14-21    16 0.044568245
#> 26:       16-17      21-28    15 0.041782730
#> 27:       16-17      28-34     7 0.019498607
#> 28:       16-17 34 or more    12 0.033426184
#> 29:       18-24  Exactly 0     5 0.014084507
#> 30:       18-24        0-7   262 0.738028169
#> 31:       18-24       7-14    47 0.132394366
#> 32:       18-24      14-21    21 0.059154930
#> 33:       18-24      21-28     8 0.022535211
#> 34:       18-24      28-34     6 0.016901408
#> 35:       18-24 34 or more     6 0.016901408
#> 36:       25-34  Exactly 0     9 0.026011561
#> 37:       25-34        0-7   248 0.716763006
#> 38:       25-34       7-14    50 0.144508671
#> 39:       25-34      14-21    17 0.049132948
#> 40:       25-34      21-28     7 0.020231214
#> 41:       25-34      28-34     5 0.014450867
#> 42:       25-34 34 or more    10 0.028901734
#> 43:       35-44  Exactly 0     3 0.008645533
#> 44:       35-44        0-7   247 0.711815562
#> 45:       35-44       7-14    54 0.155619597
#> 46:       35-44      14-21    21 0.060518732
#> 47:       35-44      21-28     9 0.025936599
#> 48:       35-44      28-34     3 0.008645533
#> 49:       35-44 34 or more    10 0.028818444
#> 50:       45-54  Exactly 0     3 0.009375000
#> 51:       45-54        0-7   242 0.756250000
#> 52:       45-54       7-14    42 0.131250000
#> 53:       45-54      14-21    14 0.043750000
#> 54:       45-54      21-28    10 0.031250000
#> 55:       45-54      28-34     4 0.012500000
#> 56:       45-54 34 or more     5 0.015625000
#> 57:       55-64  Exactly 0     7 0.021943574
#> 58:       55-64        0-7   250 0.783699060
#> 59:       55-64       7-14    33 0.103448276
#> 60:       55-64      14-21     9 0.028213166
#> 61:       55-64      21-28    11 0.034482759
#> 62:       55-64      28-34     2 0.006269592
#> 63:       55-64 34 or more     7 0.021943574
#> 64:       65-74  Exactly 0     8 0.026143791
#> 65:       65-74        0-7   198 0.647058824
#> 66:       65-74       7-14    62 0.202614379
#> 67:       65-74      14-21    19 0.062091503
#> 68:       65-74      21-28     5 0.016339869
#> 69:       65-74      28-34     4 0.013071895
#> 70:       65-74 34 or more    10 0.032679739
#> 71:       75-84  Exactly 0     8 0.022408964
#> 72:       75-84        0-7   259 0.725490196
#> 73:       75-84       7-14    54 0.151260504
#> 74:       75-84      14-21    14 0.039215686
#> 75:       75-84      21-28     9 0.025210084
#> 76:       75-84      28-34     4 0.011204482
#> 77:       75-84 34 or more     9 0.025210084
#> 78: 85 or older  Exactly 0     8 0.022662890
#> 79: 85 or older        0-7   263 0.745042493
#> 80: 85 or older       7-14    42 0.118980170
#> 81: 85 or older      14-21    17 0.048158640
#> 82: 85 or older      21-28     9 0.025495751
#> 83: 85 or older      28-34     8 0.022662890
#> 84: 85 or older 34 or more     6 0.016997167
#>             age  num_trips count        prop
#> 
#> $cat$summary$wtd
#>             age  num_trips count         prop    est
#>  1:     Under 5  Exactly 0     9 0.0211505146   3919
#>  2:     Under 5        0-7   256 0.8744191569 162022
#>  3:     Under 5       7-14    55 0.0809159646  14993
#>  4:     Under 5      14-21    16 0.0120944892   2241
#>  5:     Under 5      21-28    14 0.0074315536   1377
#>  6:     Under 5      28-34     2 0.0008635066    160
#>  7:     Under 5 34 or more    10 0.0031248145    579
#>  8:        5-11  Exactly 0     4 0.0133856015   2059
#>  9:        5-11        0-7   216 0.8930647112 137373
#> 10:        5-11       7-14    40 0.0704060538  10830
#> 11:        5-11      14-21    15 0.0139706934   2149
#> 12:        5-11      21-28     7 0.0057404012    883
#> 13:        5-11      28-34     1 0.0007801225    120
#> 14:        5-11 34 or more     9 0.0026524164    408
#> 15:       12-15  Exactly 0     6 0.0183727687   2953
#> 16:       12-15        0-7   227 0.8846677907 142190
#> 17:       12-15       7-14    42 0.0767885918  12342
#> 18:       12-15      14-21    14 0.0136878060   2200
#> 19:       12-15      21-28     6 0.0029366566    472
#> 20:       12-15      28-34     4 0.0015367673    247
#> 21:       12-15 34 or more     6 0.0020096188    323
#> 22:       16-17  Exactly 0     9 0.0226963834   4108
#> 23:       16-17        0-7   258 0.8880650615 160738
#> 24:       16-17       7-14    42 0.0625918518  11329
#> 25:       16-17      14-21    16 0.0122984784   2226
#> 26:       16-17      21-28    15 0.0087570028   1585
#> 27:       16-17      28-34     7 0.0026740627    484
#> 28:       16-17 34 or more    12 0.0029171593    528
#> 29:       18-24  Exactly 0     5 0.0140183641   2600
#> 30:       18-24        0-7   262 0.8924252309 165519
#> 31:       18-24       7-14    47 0.0663661705  12309
#> 32:       18-24      14-21    21 0.0172695462   3203
#> 33:       18-24      21-28     8 0.0054402036   1009
#> 34:       18-24      28-34     6 0.0029546398    548
#> 35:       18-24 34 or more     6 0.0015258450    283
#> 36:       25-34  Exactly 0     9 0.0264441887   4596
#> 37:       25-34        0-7   248 0.8746720368 152018
#> 38:       25-34       7-14    50 0.0776179517  13490
#> 39:       25-34      14-21    17 0.0121691600   2115
#> 40:       25-34      21-28     7 0.0040103567    697
#> 41:       25-34      28-34     5 0.0021231300    369
#> 42:       25-34 34 or more    10 0.0029631761    515
#> 43:       35-44  Exactly 0     3 0.0077003501   1311
#> 44:       35-44        0-7   247 0.8723715434 148523
#> 45:       35-44       7-14    54 0.0890209807  15156
#> 46:       35-44      14-21    21 0.0206869817   3522
#> 47:       35-44      21-28     9 0.0054331227    925
#> 48:       35-44      28-34     3 0.0014507906    247
#> 49:       35-44 34 or more    10 0.0033362310    568
#> 50:       45-54  Exactly 0     3 0.0062074466   1043
#> 51:       45-54        0-7   242 0.8991632148 151081
#> 52:       45-54       7-14    42 0.0713826596  11994
#> 53:       45-54      14-21    14 0.0135516355   2277
#> 54:       45-54      21-28    10 0.0065109746   1094
#> 55:       45-54      28-34     4 0.0016307194    274
#> 56:       45-54 34 or more     5 0.0015533495    261
#> 57:       55-64  Exactly 0     7 0.0211599023   3588
#> 58:       55-64        0-7   250 0.9094924690 154219
#> 59:       55-64       7-14    33 0.0490428506   8316
#> 60:       55-64      14-21     9 0.0093179057   1580
#> 61:       55-64      21-28    11 0.0073481712   1246
#> 62:       55-64      28-34     2 0.0010910206    185
#> 63:       55-64 34 or more     7 0.0025476805    432
#> 64:       65-74  Exactly 0     8 0.0249656885   3820
#> 65:       65-74        0-7   198 0.8311090778 127168
#> 66:       65-74       7-14    62 0.1171622770  17927
#> 67:       65-74      14-21    19 0.0173191295   2650
#> 68:       65-74      21-28     5 0.0033723286    516
#> 69:       65-74      28-34     4 0.0022874322    350
#> 70:       65-74 34 or more    10 0.0037840664    579
#> 71:       75-84  Exactly 0     8 0.0224890591   4111
#> 72:       75-84        0-7   259 0.8701641138 159066
#> 73:       75-84       7-14    54 0.0853391685  15600
#> 74:       75-84      14-21    14 0.0099343545   1816
#> 75:       75-84      21-28     9 0.0061652079   1127
#> 76:       75-84      28-34     4 0.0029102845    532
#> 77:       75-84 34 or more     9 0.0029978118    548
#> 78: 85 or older  Exactly 0     8 0.0274262382   5199
#> 79: 85 or older        0-7   263 0.8830520724 167394
#> 80: 85 or older       7-14    42 0.0637993701  12094
#> 81: 85 or older      14-21    17 0.0152455912   2890
#> 82: 85 or older      21-28     9 0.0048901948    927
#> 83: 85 or older      28-34     8 0.0032601299    618
#> 84: 85 or older 34 or more     6 0.0023264034    441
#>             age  num_trips count         prop    est
#> 
#> $cat$summary$weight_name
#> [1] "day_weight"
#> 
#> 
#> $cat$summarize_var
#> [1] "num_trips"
#> 
#> $cat$summarize_by
#> [1] "age"
#> 
#> 
#> $num
#> $num$n_ls
#> $num$n_ls$unwtd
#> $num$n_ls$unwtd$`Count of unique hh_id`
#> [1] 821
#> 
#> $num$n_ls$unwtd$`Count of unique person_id`
#> [1] 1743
#> 
#> $num$n_ls$unwtd$`Count of unique day_id`
#> [1] 4021
#> 
#> 
#> $num$n_ls$wtd
#> Sum of day_weight 
#>           2073324 
#> 
#> 
#> $num$summary
#> $num$summary$unwtd
#>             age count min      max     mean   median
#>  1:     Under 5   362   0 60.77358 6.678020 3.638851
#>  2:        5-11   292   0 64.44681 6.453618 3.330964
#>  3:       12-15   305   0 66.08108 6.395317 3.691882
#>  4:       16-17   359   0 66.63636 7.308847 3.585366
#>  5:       18-24   355   0 57.37500 6.459746 3.636804
#>  6:       25-34   346   0 63.02941 6.829649 3.612824
#>  7:       35-44   347   0 62.41860 7.102319 3.927928
#>  8:       45-54   320   0 63.39535 6.192273 3.628440
#>  9:       55-64   319   0 63.17778 5.967302 3.305263
#> 10:       65-74   306   0 66.57407 7.516483 4.428346
#> 11:       75-84   357   0 63.66667 6.557999 3.678182
#> 12: 85 or older   353   0 49.28947 6.107548 3.211509
#> 
#> $num$summary$wtd
#>             age count min      max     mean   median
#>  1:     Under 5   362   0 60.77358 3.695582 2.734307
#>  2:        5-11   292   0 64.44681 3.536211 2.450932
#>  3:       12-15   305   0 66.08108 3.704014 2.980241
#>  4:       16-17   359   0 66.63636 3.815749 3.034014
#>  5:       18-24   355   0 57.37500 3.745745 2.891026
#>  6:       25-34   346   0 63.02941 3.697330 2.774242
#>  7:       35-44   347   0 62.41860 4.063018 3.006522
#>  8:       45-54   320   0 63.39535 3.581221 2.576602
#>  9:       55-64   319   0 63.17778 3.460617 2.494253
#> 10:       65-74   306   0 66.57407 4.178773 3.061633
#> 11:       75-84   357   0 63.66667 3.822949 2.841629
#> 12: 85 or older   353   0 49.28947 3.459594 2.458980
#> 
#> $num$summary$weight_name
#> [1] "day_weight"
#> 
#> 
#>