diff --git a/DESCRIPTION b/DESCRIPTION index 8b048f0..e745935 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: travelSurveyTools Title: travelSurveyTools -Version: 2.3.9 +Version: 2.4.0 Authors@R: c( person("RSG", "Inc.", , "rsg@rsginc.com", role = c("aut", "cre")), person("Ashley", "Asmus", , "ashley.asmus@rsginc.com", role = "aut"), diff --git a/NAMESPACE b/NAMESPACE index 4de8b5e..99d932a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -19,6 +19,7 @@ export(hts_remove_outliers) export(hts_summary) export(hts_summary_cat) export(hts_summary_num) +export(hts_summary_wrapper) export(hts_to_so) export(hts_trip_vehid) export(hts_validate_variable_list) diff --git a/NEWS.md b/NEWS.md index b7ae1e7..cf83492 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# travelSurveyTools 2.4.0 + +- Add wrapper function `'hts_summary_wrapper` to run hts_prep_triprate/variable and hts_summary + # travelSurveyTools 2.3.8 - Fix join in `hts_prep_triprate` to properly count days when summarize_by is trip variable. diff --git a/R/hts_summary_wrapper.R b/R/hts_summary_wrapper.R new file mode 100644 index 0000000..74939a5 --- /dev/null +++ b/R/hts_summary_wrapper.R @@ -0,0 +1,237 @@ +#' Make household travel survey summaries-- runs hts_prep_variable and hts_summary +#' @param summarize_var Name of the variable to summarize. Default is NULL +#' @param summarize_by Name of the variable to summarize the summarize_var by. +#' Default is NULL. +#' @param variables_dt List of variable locations and descriptions in data.table +#' format. +#' @param data List of household, person, vehicle, day, and trip tables in +#' data.table format. +#' @param id_cols name of unique identifier for each table in hts_data +#' @param weighted Whether the data is weighted. Default is TRUE. +#' @param wt_cols weight name for each table in hts_data +#' @param trip_name Name of the trip dataset in hts_data. +#' @param day_name Name of the day dataset in hts_data. +#' @param strataname Name of strata name to bring in. Default is NULL. +#' @param se Whether to calculate standard error. Default is FALSE. Will be set +#' to FALSE if weighted is FALSE. +#' @param wtname Name of the weight column to use. Default is NULL. Must be specified +#' when weighted = TRUE. +#' @param checkbox_valname Name of the column with the checkbox value. Default is 'value'. +#' Must be provided if summarize_var is a checkbox variable. +#' @param checkbox_yesval Value of checkbox_valname that indicates it was selected. +#' Default is 1. Must be provided if summarize_var is a checkbox variable. +#' @param remove_outliers Whether to remove outliers for numeric variable. Default +#' is TRUE. +#' @param threshold Threshold to define outliers. Default is 0.975. +#' @param remove_missing Whether to remove missing values from the summary. +#' Default is TRUE. +#' @param not_imputable Value representing 'Not imputable' to remove. Default +#' is -1. +#' @param missing_values Missing values to remove. Default is 995. +#' +#' @return 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. +#' @export +#' +#' @examples +#' +#' +#' hts_summary_wrapper( +#' summarize_var = 'employment', +#' summarize_by = 'age', +#' wtname = 'person_weight') +#' +#' +#' hts_summary_wrapper( +#' summarize_var = 'race', +#' summarize_by = c('age', 'employment'), +#' wtname = 'person_weight', +#' ) +#' +#' hts_summary_wrapper( +#' summarize_var = 'num_trips', +#' summarize_by = 'age', +#' wtname = 'person_weight') +#' +#' + + +hts_summary_wrapper = function( + summarize_var = NULL, + summarize_by = NULL, + variables_dt = variable_list, + 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, + wtname = NULL, + checkbox_valname = "value", + checkbox_yesval = 1, + remove_outliers = TRUE, + threshold = 0.975, + remove_missing = TRUE, + not_imputable = -1, + missing_values = c("Missing Response", "995") +){ + + + # Decide what prep function to run + if (summarize_var != 'num_trips'){ + + prepped_dt_ls = hts_prep_variable( + summarize_var = summarize_var, + summarize_by = summarize_by, + variables_dt = variables_dt, + data = data, + id_cols = id_cols, + weighted = weighted, + wt_cols = wt_cols, + remove_outliers = remove_outliers, + threshold = threshold, + remove_missing = remove_missing, + missing_values = missing_values, + not_imputable = not_imputable, + strataname = strataname + ) + + } else { + + prepped_dt_ls = hts_prep_triprate( + summarize_by = summarize_by, + variables_dt = variable_list, + trip_name = trip_name, + day_name = day_name, + ids = id_cols, + wts = wt_cols, + remove_outliers = remove_outliers, + threshold = threshold, + weighted = weighted, + hts_data = data + ) + + } + + # If a checkbox variable use chexkbox for summarize_vartype + if (variable_list[shared_name == summarize_var, .N] > 1){ + + summarize_vartype = 'checkbox' + + } else { + + summarize_vartype = 'categorical' + + } + + prepped_dt = prepped_dt_ls$cat + + # if we prepped a triprate rename summarize_var for hts_summary + if (summarize_var == 'num_trips'){ + + + if (weighted){ + + # summarize_var = 'num_trips_wtd' + + setnames(prepped_dt, 'num_trips_wtd', 'num_trips') + + } else { + + # summarize_var = 'num_trips_unwtd' + + setnames(prepped_dt, 'num_trips_unwtd', 'num_trips') + + } + + } + + # run hts_summary + output_ls_cat = hts_summary( + prepped_dt, + summarize_var = summarize_var, + summarize_by = summarize_by, + summarize_vartype = summarize_vartype, + id_cols = id_cols, + weighted = weighted, + se = se, + wtname = wtname, + strataname = strataname, + checkbox_valname = checkbox_valname, + checkbox_yesval = checkbox_yesval + ) + + if (!is.null(prepped_dt_ls$num)){ + + prepped_dt = prepped_dt_ls$num + + # if we prepped a triprate rename summarize_var for hts_summary + if (summarize_var == 'num_trips'){ + + + if (weighted){ + + # summarize_var = 'num_trips_wtd' + + setnames(prepped_dt, 'num_trips_wtd', 'num_trips') + + } else { + + # summarize_var = 'num_trips_unwtd' + + setnames(prepped_dt, 'num_trips_unwtd', 'num_trips') + + } + + + } + + + output_ls_num = hts_summary( + prepped_dt, + summarize_var = summarize_var, + summarize_by = summarize_by, + summarize_vartype = 'numeric', + id_cols = id_cols, + weighted = weighted, + se = se, + wtname = wtname, + strataname = strataname, + checkbox_valname = checkbox_valname, + checkbox_yesval = checkbox_yesval + ) + } else { + + output_ls_num = NULL + + } + + output_ls = list( + 'cat' = output_ls_cat, + 'num' = output_ls_num + ) + + + return(output_ls) + + +} + +## quiets concerns of R CMD check +utils::globalVariables(c("hts_data", "is_checkbox", "data_type", "old_weight")) \ No newline at end of file diff --git a/_pkgdown.yml b/_pkgdown.yml index da1a5ef..68a545f 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -34,6 +34,7 @@ reference: - hts_summary_cat - hts_summary_num - hts_to_so + - hts_summary_wrapper - subtitle: Helper functions contents: diff --git a/docs/404.html b/docs/404.html index b24eae7..4cbc2d0 100644 --- a/docs/404.html +++ b/docs/404.html @@ -24,7 +24,7 @@ travelSurveyTools - 2.3.9 + 2.4.0 + + + + + +
+
+
+ +
+

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,
+  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,
+  wtname = NULL,
+  checkbox_valname = "value",
+  checkbox_yesval = 1,
+  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.

+ + +
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.

+ + +
wtname
+

Name of the weight column to use. Default is NULL. Must be specified +when weighted = TRUE.

+ + +
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.

+ + +
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 = 'age',
+wtname = 'person_weight')
+#> $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
+#>     age employment count        prop
+#>  1:   1          1    68 0.444444444
+#>  2:   1          2    16 0.104575163
+#>  3:   1          3     9 0.058823529
+#>  4:   1          5    50 0.326797386
+#>  5:   1          6     8 0.052287582
+#>  6:   1          7     1 0.006535948
+#>  7:   1          8     1 0.006535948
+#>  8:   2          1    73 0.540740741
+#>  9:   2          2    12 0.088888889
+#> 10:   2          3     8 0.059259259
+#> 11:   2          5    36 0.266666667
+#> 12:   2          6     4 0.029629630
+#> 13:   2          7     1 0.007407407
+#> 14:   2          8     1 0.007407407
+#> 15:   3          1    77 0.538461538
+#> 16:   3          2     6 0.041958042
+#> 17:   3          3     8 0.055944056
+#> 18:   3          5    37 0.258741259
+#> 19:   3          6     7 0.048951049
+#> 20:   3          7     4 0.027972028
+#> 21:   3          8     4 0.027972028
+#> 22:   4          1    82 0.546666667
+#> 23:   4          2    12 0.080000000
+#> 24:   4          3     3 0.020000000
+#> 25:   4          5    43 0.286666667
+#> 26:   4          6     9 0.060000000
+#> 27:   4          8     1 0.006666667
+#> 28:   5          1    80 0.522875817
+#> 29:   5          2    10 0.065359477
+#> 30:   5          3    11 0.071895425
+#> 31:   5          5    42 0.274509804
+#> 32:   5          6     6 0.039215686
+#> 33:   5          7     3 0.019607843
+#> 34:   5          8     1 0.006535948
+#> 35:   6          1    70 0.503597122
+#> 36:   6          2    14 0.100719424
+#> 37:   6          3     6 0.043165468
+#> 38:   6          5    42 0.302158273
+#> 39:   6          6     5 0.035971223
+#> 40:   6          8     2 0.014388489
+#> 41:   7          1    78 0.516556291
+#> 42:   7          2    10 0.066225166
+#> 43:   7          3    10 0.066225166
+#> 44:   7          5    44 0.291390728
+#> 45:   7          6     8 0.052980132
+#> 46:   7          8     1 0.006622517
+#> 47:   8          1    79 0.484662577
+#> 48:   8          2    15 0.092024540
+#> 49:   8          3    13 0.079754601
+#> 50:   8          5    51 0.312883436
+#> 51:   8          6     4 0.024539877
+#> 52:   8          7     1 0.006134969
+#> 53:   9          1    69 0.496402878
+#> 54:   9          2    14 0.100719424
+#> 55:   9          3    11 0.079136691
+#> 56:   9          5    36 0.258992806
+#> 57:   9          6     5 0.035971223
+#> 58:   9          7     1 0.007194245
+#> 59:   9          8     3 0.021582734
+#> 60:  10          1    68 0.515151515
+#> 61:  10          2    10 0.075757576
+#> 62:  10          3     9 0.068181818
+#> 63:  10          5    32 0.242424242
+#> 64:  10          6    10 0.075757576
+#> 65:  10          7     2 0.015151515
+#> 66:  10          8     1 0.007575758
+#> 67:  11          1    82 0.512500000
+#> 68:  11          2    15 0.093750000
+#> 69:  11          3    13 0.081250000
+#> 70:  11          5    40 0.250000000
+#> 71:  11          6     8 0.050000000
+#> 72:  11          7     1 0.006250000
+#> 73:  11          8     1 0.006250000
+#> 74:  12          1    71 0.467105263
+#> 75:  12          2    17 0.111842105
+#> 76:  12          3     9 0.059210526
+#> 77:  12          5    48 0.315789474
+#> 78:  12          6     7 0.046052632
+#>     age employment count        prop
+#> 
+#> $cat$summary$wtd
+#>     age employment count        prop   est
+#>  1:   1          1    68 0.431768082 35060
+#>  2:   1          2    16 0.116033054  9422
+#>  3:   1          3     9 0.076045862  6175
+#>  4:   1          5    50 0.291708230 23687
+#>  5:   1          6     8 0.062179037  5049
+#>  6:   1          7     1 0.009987562   811
+#>  7:   1          8     1 0.012278174   997
+#>  8:   2          1    73 0.510666817 31621
+#>  9:   2          2    12 0.108509230  6719
+#> 10:   2          3     8 0.078115664  4837
+#> 11:   2          5    36 0.239159574 14809
+#> 12:   2          6     4 0.045428853  2813
+#> 13:   2          7     1 0.002696985   167
+#> 14:   2          8     1 0.015422878   955
+#> 15:   3          1    77 0.522054934 40465
+#> 16:   3          2     6 0.045696740  3542
+#> 17:   3          3     8 0.043503503  3372
+#> 18:   3          5    37 0.262814310 20371
+#> 19:   3          6     7 0.055463096  4299
+#> 20:   3          7     4 0.037710777  2923
+#> 21:   3          8     4 0.032756641  2539
+#> 22:   4          1    82 0.518540589 38288
+#> 23:   4          2    12 0.112679108  8320
+#> 24:   4          3     3 0.019542783  1443
+#> 25:   4          5    43 0.276131531 20389
+#> 26:   4          6     9 0.069002411  5095
+#> 27:   4          8     1 0.004103578   303
+#> 28:   5          1    80 0.516957618 43472
+#> 29:   5          2    10 0.065618608  5518
+#> 30:   5          3    11 0.079603292  6694
+#> 31:   5          5    42 0.284759549 23946
+#> 32:   5          6     6 0.025995338  2186
+#> 33:   5          7     3 0.015768444  1326
+#> 34:   5          8     1 0.011297151   950
+#> 35:   6          1    70 0.539207351 36149
+#> 36:   6          2    14 0.081741024  5480
+#> 37:   6          3     6 0.041168837  2760
+#> 38:   6          5    42 0.288480184 19340
+#> 39:   6          6     5 0.042183142  2828
+#> 40:   6          8     2 0.007219463   484
+#> 41:   7          1    78 0.527234938 39066
+#> 42:   7          2    10 0.050704491  3757
+#> 43:   7          3    10 0.093432844  6923
+#> 44:   7          5    44 0.274333297 20327
+#> 45:   7          6     8 0.048342691  3582
+#> 46:   7          8     1 0.005951738   441
+#> 47:   8          1    79 0.479060279 35461
+#> 48:   8          2    15 0.092337413  6835
+#> 49:   8          3    13 0.080030261  5924
+#> 50:   8          5    51 0.313825619 23230
+#> 51:   8          6     4 0.030355840  2247
+#> 52:   8          7     1 0.004390587   325
+#> 53:   9          1    69 0.531648697 36587
+#> 54:   9          2    14 0.078191752  5381
+#> 55:   9          3    11 0.075212880  5176
+#> 56:   9          5    36 0.245706065 16909
+#> 57:   9          6     5 0.043418873  2988
+#> 58:   9          7     1 0.005725246   394
+#> 59:   9          8     3 0.020096486  1383
+#> 60:  10          1    68 0.459676752 33333
+#> 61:  10          2    10 0.088479466  6416
+#> 62:  10          3     9 0.081956588  5943
+#> 63:  10          5    32 0.251937557 18269
+#> 64:  10          6    10 0.082094492  5953
+#> 65:  10          7     2 0.022243980  1613
+#> 66:  10          8     1 0.013611165   987
+#> 67:  11          1    82 0.517030042 45555
+#> 68:  11          2    15 0.108082035  9523
+#> 69:  11          3    13 0.070344687  6198
+#> 70:  11          5    40 0.260722514 22972
+#> 71:  11          6     8 0.031790169  2801
+#> 72:  11          7     1 0.010759400   948
+#> 73:  11          8     1 0.001271153   112
+#> 74:  12          1    71 0.462725456 36584
+#> 75:  12          2    17 0.106701070  8436
+#> 76:  12          3     9 0.063886570  5051
+#> 77:  12          5    48 0.316789355 25046
+#> 78:  12          6     7 0.049897549  3945
+#>     age employment count        prop   est
+#> 
+#> $cat$summary$weight_name
+#> [1] "person_weight"
+#> 
+#> 
+#> 
+#> $num
+#> NULL
+#> 
+
+
+hts_summary_wrapper(
+summarize_var = 'race',
+summarize_by = c('age', 'employment'),
+wtname = 'person_weight',
+)
+#> $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                                      race count      prop
+#>   1:   1          1                 African American or Black    19 0.2794118
+#>   2:   1          1          American Indian or Alaska Native    18 0.2647059
+#>   3:   1          1                                     Asian    21 0.3088235
+#>   4:   1          1 Native Hawaiian or other Pacific Islander    20 0.2941176
+#>   5:   1          1                                     White    19 0.2794118
+#>  ---                                                                         
+#> 427:  12          6          American Indian or Alaska Native     2 0.2857143
+#> 428:  12          6                                     Asian     2 0.2857143
+#> 429:  12          6 Native Hawaiian or other Pacific Islander     2 0.2857143
+#> 430:  12          6                                     White     2 0.2857143
+#> 431:  12          6                      Prefer not to answer     3 0.4285714
+#> 
+#> $cat$summary$wtd
+#>      age employment                                      race count      prop
+#>   1:   1          1                 African American or Black    19 0.2678266
+#>   2:   1          1          American Indian or Alaska Native    18 0.2697946
+#>   3:   1          1                                     Asian    21 0.2495722
+#>   4:   1          1 Native Hawaiian or other Pacific Islander    20 0.2790645
+#>   5:   1          1                                     White    19 0.2383058
+#>  ---                                                                         
+#> 427:  12          6          American Indian or Alaska Native     2 0.2094723
+#> 428:  12          6                                     Asian     2 0.2094723
+#> 429:  12          6 Native Hawaiian or other Pacific Islander     2 0.3161028
+#> 430:  12          6                      Prefer not to answer     3 0.5412720
+#> 431:  12          6                                     White     2 0.3918809
+#>       est wtd_group_n
+#>   1: 9390       35060
+#>   2: 9459       35060
+#>   3: 8750       35060
+#>   4: 9784       35060
+#>   5: 8355       35060
+#>  ---                 
+#> 427:  774        3695
+#> 428:  774        3695
+#> 429: 1168        3695
+#> 430: 2000        3695
+#> 431: 1448        3695
+#> 
+#> $cat$summary$weight_name
+#> [1] "person_weight"
+#> 
+#> 
+#> 
+#> $num
+#> NULL
+#> 
+
+hts_summary_wrapper(
+summarize_var = 'num_trips',
+summarize_by = 'age',
+wtname = 'person_weight')
+#> $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 person_weight 
+#>              2052306 
+#> 
+#> 
+#> $cat$summary
+#> $cat$summary$unwtd
+#>     age  num_trips count        prop
+#>  1:   1  Exactly 0     9 0.024861878
+#>  2:   1        0-7   256 0.707182320
+#>  3:   1       7-14    55 0.151933702
+#>  4:   1      14-21    16 0.044198895
+#>  5:   1      21-28    14 0.038674033
+#>  6:   1      28-34     2 0.005524862
+#>  7:   1 34 or more    10 0.027624309
+#>  8:   2  Exactly 0     4 0.013698630
+#>  9:   2        0-7   216 0.739726027
+#> 10:   2       7-14    40 0.136986301
+#> 11:   2      14-21    15 0.051369863
+#> 12:   2      21-28     7 0.023972603
+#> 13:   2      28-34     1 0.003424658
+#> 14:   2 34 or more     9 0.030821918
+#> 15:   3  Exactly 0     6 0.019672131
+#> 16:   3        0-7   227 0.744262295
+#> 17:   3       7-14    42 0.137704918
+#> 18:   3      14-21    14 0.045901639
+#> 19:   3      21-28     6 0.019672131
+#> 20:   3      28-34     4 0.013114754
+#> 21:   3 34 or more     6 0.019672131
+#> 22:   4  Exactly 0     9 0.025069638
+#> 23:   4        0-7   258 0.718662953
+#> 24:   4       7-14    42 0.116991643
+#> 25:   4      14-21    16 0.044568245
+#> 26:   4      21-28    15 0.041782730
+#> 27:   4      28-34     7 0.019498607
+#> 28:   4 34 or more    12 0.033426184
+#> 29:   5  Exactly 0     5 0.014084507
+#> 30:   5        0-7   262 0.738028169
+#> 31:   5       7-14    47 0.132394366
+#> 32:   5      14-21    21 0.059154930
+#> 33:   5      21-28     8 0.022535211
+#> 34:   5      28-34     6 0.016901408
+#> 35:   5 34 or more     6 0.016901408
+#> 36:   6  Exactly 0     9 0.026011561
+#> 37:   6        0-7   248 0.716763006
+#> 38:   6       7-14    50 0.144508671
+#> 39:   6      14-21    17 0.049132948
+#> 40:   6      21-28     7 0.020231214
+#> 41:   6      28-34     5 0.014450867
+#> 42:   6 34 or more    10 0.028901734
+#> 43:   7  Exactly 0     3 0.008645533
+#> 44:   7        0-7   247 0.711815562
+#> 45:   7       7-14    54 0.155619597
+#> 46:   7      14-21    21 0.060518732
+#> 47:   7      21-28     9 0.025936599
+#> 48:   7      28-34     3 0.008645533
+#> 49:   7 34 or more    10 0.028818444
+#> 50:   8  Exactly 0     3 0.009375000
+#> 51:   8        0-7   242 0.756250000
+#> 52:   8       7-14    42 0.131250000
+#> 53:   8      14-21    14 0.043750000
+#> 54:   8      21-28    10 0.031250000
+#> 55:   8      28-34     4 0.012500000
+#> 56:   8 34 or more     5 0.015625000
+#> 57:   9  Exactly 0     7 0.021943574
+#> 58:   9        0-7   250 0.783699060
+#> 59:   9       7-14    33 0.103448276
+#> 60:   9      14-21     9 0.028213166
+#> 61:   9      21-28    11 0.034482759
+#> 62:   9      28-34     2 0.006269592
+#> 63:   9 34 or more     7 0.021943574
+#> 64:  10  Exactly 0     8 0.026143791
+#> 65:  10        0-7   198 0.647058824
+#> 66:  10       7-14    62 0.202614379
+#> 67:  10      14-21    19 0.062091503
+#> 68:  10      21-28     5 0.016339869
+#> 69:  10      28-34     4 0.013071895
+#> 70:  10 34 or more    10 0.032679739
+#> 71:  11  Exactly 0     8 0.022408964
+#> 72:  11        0-7   259 0.725490196
+#> 73:  11       7-14    54 0.151260504
+#> 74:  11      14-21    14 0.039215686
+#> 75:  11      21-28     9 0.025210084
+#> 76:  11      28-34     4 0.011204482
+#> 77:  11 34 or more     9 0.025210084
+#> 78:  12  Exactly 0     8 0.022662890
+#> 79:  12        0-7   263 0.745042493
+#> 80:  12       7-14    42 0.118980170
+#> 81:  12      14-21    17 0.048158640
+#> 82:  12      21-28     9 0.025495751
+#> 83:  12      28-34     8 0.022662890
+#> 84:  12 34 or more     6 0.016997167
+#>     age  num_trips count        prop
+#> 
+#> $cat$summary$wtd
+#>     age  num_trips count         prop    est
+#>  1:   1  Exactly 0     9 0.0224548112   4102
+#>  2:   1        0-7   256 0.7452074141 136133
+#>  3:   1       7-14    55 0.1323531022  24178
+#>  4:   1      14-21    16 0.0453968184   8293
+#>  5:   1      21-28    14 0.0308904192   5643
+#>  6:   1      28-34     2 0.0006185748    113
+#>  7:   1 34 or more    10 0.0230788601   4216
+#>  8:   2  Exactly 0     4 0.0137997083   1902
+#>  9:   2        0-7   216 0.7187602029  99066
+#> 10:   2       7-14    40 0.1495113510  20607
+#> 11:   2      14-21    15 0.0579195960   7983
+#> 12:   2      21-28     7 0.0288981274   3983
+#> 13:   2      28-34     1 0.0049916926    688
+#> 14:   2 34 or more     9 0.0261193218   3600
+#> 15:   3  Exactly 0     6 0.0126130513   2124
+#> 16:   3        0-7   227 0.7474895634 125875
+#> 17:   3       7-14    42 0.1423540799  23972
+#> 18:   3      14-21    14 0.0425720173   7169
+#> 19:   3      21-28     6 0.0262296834   4417
+#> 20:   3      28-34     4 0.0092519463   1558
+#> 21:   3 34 or more     6 0.0194896584   3282
+#> 22:   4  Exactly 0     9 0.0221081589   3954
+#> 23:   4        0-7   258 0.7085290302 126719
+#> 24:   4       7-14    42 0.1154499911  20648
+#> 25:   4      14-21    16 0.0386641170   6915
+#> 26:   4      21-28    15 0.0489130435   8748
+#> 27:   4      28-34     7 0.0245012525   4382
+#> 28:   4 34 or more    12 0.0418344069   7482
+#> 29:   5  Exactly 0     5 0.0106922521   2026
+#> 30:   5        0-7   262 0.7435601083 140892
+#> 31:   5       7-14    47 0.1303810896  24705
+#> 32:   5      14-21    21 0.0658423183  12476
+#> 33:   5      21-28     8 0.0125974362   2387
+#> 34:   5      28-34     6 0.0163444742   3097
+#> 35:   5 34 or more     6 0.0205823214   3900
+#> 36:   6  Exactly 0     9 0.0299933946   5131
+#> 37:   6        0-7   248 0.7440711751 127289
+#> 38:   6       7-14    50 0.1215752524  20798
+#> 39:   6      14-21    17 0.0501546142   8580
+#> 40:   6      21-28     7 0.0167006681   2857
+#> 41:   6      28-34     5 0.0119774830   2049
+#> 42:   6 34 or more    10 0.0255274126   4367
+#> 43:   7  Exactly 0     3 0.0150261793   2514
+#> 44:   7        0-7   247 0.6905348220 115532
+#> 45:   7       7-14    54 0.1599564874  26762
+#> 46:   7      14-21    21 0.0669603366  11203
+#> 47:   7      21-28     9 0.0297116695   4971
+#> 48:   7      28-34     3 0.0069930906   1170
+#> 49:   7 34 or more    10 0.0308174146   5156
+#> 50:   8  Exactly 0     3 0.0128387435   1887
+#> 51:   8        0-7   242 0.7411091531 108926
+#> 52:   8       7-14    42 0.1347693857  19808
+#> 53:   8      14-21    14 0.0503003871   7393
+#> 54:   8      21-28    10 0.0234594528   3448
+#> 55:   8      28-34     4 0.0177170578   2604
+#> 56:   8 34 or more     5 0.0198058200   2911
+#> 57:   9  Exactly 0     7 0.0221603968   3664
+#> 58:   9        0-7   250 0.8024857869 132683
+#> 59:   9       7-14    33 0.0984153865  16272
+#> 60:   9      14-21     9 0.0187855328   3106
+#> 61:   9      21-28    11 0.0269384299   4454
+#> 62:   9      28-34     2 0.0058243619    963
+#> 63:   9 34 or more     7 0.0253901052   4198
+#> 64:  10  Exactly 0     8 0.0259672516   4331
+#> 65:  10        0-7   198 0.6450562694 107587
+#> 66:  10       7-14    62 0.2003753290  33420
+#> 67:  10      14-21    19 0.0635361269  10597
+#> 68:  10      21-28     5 0.0175853034   2933
+#> 69:  10      28-34     4 0.0180229874   3006
+#> 70:  10 34 or more    10 0.0294567322   4913
+#> 71:  11  Exactly 0     8 0.0351732437   6840
+#> 72:  11        0-7   259 0.7113531414 138334
+#> 73:  11       7-14    54 0.1487355116  28924
+#> 74:  11      14-21    14 0.0331626094   6449
+#> 75:  11      21-28     9 0.0258297080   5023
+#> 76:  11      28-34     4 0.0170055434   3307
+#> 77:  11 34 or more     9 0.0287402425   5589
+#> 78:  12  Exactly 0     8 0.0304114197   5569
+#> 79:  12        0-7   263 0.7297812387 133639
+#> 80:  12       7-14    42 0.1201439478  22001
+#> 81:  12      14-21    17 0.0454887998   8330
+#> 82:  12      21-28     9 0.0328797195   6021
+#> 83:  12      28-34     8 0.0255731152   4683
+#> 84:  12 34 or more     6 0.0157217593   2879
+#>     age  num_trips count         prop    est
+#> 
+#> $cat$summary$weight_name
+#> [1] "person_weight"
+#> 
+#> 
+#> 
+#> $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 person_weight 
+#>              2052306 
+#> 
+#> 
+#> $num$summary
+#> $num$summary$unwtd
+#>     age count min      max     mean   median
+#>  1:   1   362   0 60.77358 6.678020 3.638851
+#>  2:   2   292   0 64.44681 6.453618 3.330964
+#>  3:   3   305   0 66.08108 6.395317 3.691882
+#>  4:   4   359   0 66.63636 7.308847 3.585366
+#>  5:   5   355   0 57.37500 6.459746 3.636804
+#>  6:   6   346   0 63.02941 6.829649 3.612824
+#>  7:   7   347   0 62.41860 7.102319 3.927928
+#>  8:   8   320   0 63.39535 6.192273 3.628440
+#>  9:   9   319   0 63.17778 5.967302 3.305263
+#> 10:  10   306   0 66.57407 7.516483 4.428346
+#> 11:  11   357   0 63.66667 6.557999 3.678182
+#> 12:  12   353   0 49.28947 6.107548 3.211509
+#> 
+#> $num$summary$wtd
+#>     age count min      max     mean   median
+#>  1:   1   362   0 60.77358 6.155638 3.576310
+#>  2:   2   292   0 64.44681 6.426324 3.360489
+#>  3:   3   305   0 66.08108 6.437580 3.660377
+#>  4:   4   359   0 66.63636 7.982338 3.662447
+#>  5:   5   355   0 57.37500 6.469231 3.600928
+#>  6:   6   346   0 63.02941 6.340520 3.520635
+#>  7:   7   347   0 62.41860 7.301390 3.728814
+#>  8:   8   320   0 63.39535 6.334346 3.553785
+#>  9:   9   319   0 63.17778 5.786151 3.050847
+#> 10:  10   306   0 66.57407 7.540718 4.528000
+#> 11:  11   357   0 63.66667 6.738990 3.595442
+#> 12:  12   353   0 49.28947 6.169193 2.961870
+#> 
+#> $num$summary$weight_name
+#> [1] "person_weight"
+#> 
+#> 
+#> 
+
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/hts_to_so.html b/docs/reference/hts_to_so.html index 2c13319..25eabb5 100644 --- a/docs/reference/hts_to_so.html +++ b/docs/reference/hts_to_so.html @@ -10,7 +10,7 @@ travelSurveyTools - 2.3.9 + 2.4.0