Skip to contents

Check that variable list has required elements for hts_prep_variable returns updated variable list or prompts error

Usage

hts_validate_variable_list(variable_list, hts_data)

Arguments

variable_list

Name of the variable to summarize. Default is NULL

hts_data

List of named tables specified in hts_prep_variable

Value

Cleaned variable_list

Examples

hts_validate_variable_list(variable_list, test_data)
#>               variable is_checkbox           data_type
#>  1:                age           0         categorical
#>  2:          begin_day           0         categorical
#>  3: d_purpose_category           0         categorical
#>  4:             day_id           0             numeric
#>  5:         day_weight           0             integer
#>  6:         delivery_2           1 integer/categorical
#>  7:         delivery_3           1 integer/categorical
#>  8:         delivery_4           1 integer/categorical
#>  9:         delivery_5           1 integer/categorical
#> 10:         delivery_6           1 integer/categorical
#> 11:         delivery_7           1 integer/categorical
#> 12:         delivery_8           1 integer/categorical
#> 13:       delivery_996           1 integer/categorical
#> 14:     distance_miles           0             numeric
#> 15:          education           0         categorical
#> 16:         employment           0         categorical
#> 17:            end_day           0         categorical
#> 18:        ethnicity_1           1 integer/categorical
#> 19:        ethnicity_2           1 integer/categorical
#> 20:        ethnicity_3           1 integer/categorical
#> 21:        ethnicity_4           1 integer/categorical
#> 22:      ethnicity_997           1 integer/categorical
#> 23:      ethnicity_999           1 integer/categorical
#> 24:          fuel_type           0         categorical
#> 25:             gender           0         categorical
#> 26:              hh_id           0             integer
#> 27:          hh_weight           0             integer
#> 28:        home_county           0           character
#> 29:           home_lat           0             numeric
#> 30:           home_lon           0             numeric
#> 31:    income_detailed           0         categorical
#> 32:    income_followup           0         categorical
#> 33:           job_type           0         categorical
#> 34:             mode_1           0 integer/categorical
#> 35:             mode_2           0 integer/categorical
#> 36:          mode_type           0         categorical
#> 37:         num_people           0             numeric
#> 38:      num_travelers           0         categorical
#> 39:          num_trips           0             numeric
#> 40:          person_id           0             numeric
#> 41:      person_weight           0             integer
#> 42:             race_1           1 integer/categorical
#> 43:             race_2           1 integer/categorical
#> 44:             race_3           1 integer/categorical
#> 45:             race_4           1 integer/categorical
#> 46:             race_5           1 integer/categorical
#> 47:           race_997           1 integer/categorical
#> 48:           race_999           1 integer/categorical
#> 49:     residence_type           0         categorical
#> 50:     sample_segment           0         categorical
#> 51:          speed_mph           0             numeric
#> 52:        travel_date           0                date
#> 53:            trip_id           0             numeric
#> 54:        trip_weight           0             integer
#> 55:         vehicle_id           0             numeric
#>               variable is_checkbox           data_type
#>                                                                                              description
#>  1:                                                                              Age of household member
#>  2:                                                                    Where participant began their day
#>  3:                                                                         Destination purpose category
#>  4:                                                                                               Day ID
#>  5:                                                                                           Day weight
#>  6:                                           Type of delivery: Take-out/prepared food delivered to home
#>  7:            Type of delivery: Someone came to do work at home (e.g., babysitter, housecleaning, lawn)
#>  8:                                                        Type of delivery: Groceries delivered to home
#>  9:                                 Type of delivery: Received packages at home (e.g., USPS, FedEx, UPS)
#> 10:                                                 Type of delivery: Received personal packages at work
#> 11: Type of delivery: Received packages at another location (e.g., Amazon Locker, package pick-up point)
#> 12:                                     Type of delivery: Other item delivered to home (e.g., appliance)
#> 13:                                                                  Type of delivery: None of the above
#> 14:                                                                                     Distance (miles)
#> 15:                                                                 Highest level of education completed
#> 16:                                                                                    Employment status
#> 17:                                                                    Where participant emded their day
#> 18:                                                Ethnicity: Not of Hispanic, Latino, or Spanish origin
#> 19:                                                        Ethnicity: Mexican, Mexican American, Chicano
#> 20:                                                                              Ethnicity: Puerto Rican
#> 21:                                                                                     Ethnicity: Cuban
#> 22:                                               Ethnicity: Another Hispanic, Latino, or Spanish origin
#> 23:                                                                      Ethnicity: Prefer not to answer
#> 24:                                                                                    Vehicle fuel type
#> 25:                                                                                               Gender
#> 26:                                                                                         Household ID
#> 27:                                                                                     Household weight
#> 28:                                                                               Home location-- County
#> 29:                                                                             Home location-- Latitude
#> 30:                                                                            Home location-- Longitude
#> 31:                                                   Last year's household income (detailed categories)
#> 32:                                                      Last year's household income (broad categories)
#> 33:                                                                                   Work location type
#> 34:                                                                                          Trip mode 1
#> 35:                                                                                          Trip mode 2
#> 36:                                                                                            Mode type
#> 37:                                                                          Number of household members
#> 38:                                                                     Number of people in travel party
#> 39:                                                                                      Number of trips
#> 40:                                                                                            Person ID
#> 41:                                                                                        Person weight
#> 42:                                                                      Race: African American or Black
#> 43:                                                               Race: American Indian or Alaska Native
#> 44:                                                                                          Race: Asian
#> 45:                                                      Race: Native Hawaiian or other Pacific Islander
#> 46:                                                                                          Race: White
#> 47:                                                                                     Race: Other race
#> 48:                                                                           Race: Prefer not to answer
#> 49:                                                                            Type of current residence
#> 50:                                                                                       Sample segment
#> 51:                                                                                          Speed (mph)
#> 52:                                                                                          Travel date
#> 53:                                                                                              Trip ID
#> 54:                                                                                          Trip weight
#> 55:                                                                                           Vehicle ID
#>                                                                                              description
#>            shared_name hh person day trip vehicle
#>  1:                age  0      1   0    0       0
#>  2:          begin_day  0      0   1    0       0
#>  3: d_purpose_category  0      0   0    1       0
#>  4:             day_id  0      0   1    1       0
#>  5:         day_weight  0      0   1    0       0
#>  6:           delivery  0      0   1    0       0
#>  7:           delivery  0      0   1    0       0
#>  8:           delivery  0      0   1    0       0
#>  9:           delivery  0      0   1    0       0
#> 10:           delivery  0      0   1    0       0
#> 11:           delivery  0      0   1    0       0
#> 12:           delivery  0      0   1    0       0
#> 13:           delivery  0      0   1    0       0
#> 14:     distance_miles  0      0   0    1       0
#> 15:          education  0      1   0    0       0
#> 16:         employment  0      1   0    0       0
#> 17:            end_day  0      0   1    0       0
#> 18:          ethnicity  0      1   0    0       0
#> 19:          ethnicity  0      1   0    0       0
#> 20:          ethnicity  0      1   0    0       0
#> 21:          ethnicity  0      1   0    0       0
#> 22:          ethnicity  0      1   0    0       0
#> 23:          ethnicity  0      1   0    0       0
#> 24:          fuel_type  0      0   0    0       1
#> 25:             gender  0      1   0    0       0
#> 26:              hh_id  1      1   1    1       1
#> 27:          hh_weight  1      0   0    0       0
#> 28:        home_county  1      0   0    0       0
#> 29:           home_lat  1      0   0    0       0
#> 30:           home_lon  1      0   0    0       0
#> 31:    income_detailed  1      0   0    0       0
#> 32:    income_followup  1      0   0    0       0
#> 33:           job_type  0      1   0    0       0
#> 34:             mode_1  0      0   0    1       0
#> 35:             mode_2  0      0   0    1       0
#> 36:          mode_type  0      0   0    1       0
#> 37:         num_people  1      0   0    0       0
#> 38:      num_travelers  0      0   0    1       0
#> 39:          num_trips  1      1   1    0       0
#> 40:          person_id  0      1   1    1       0
#> 41:      person_weight  0      1   0    0       0
#> 42:               race  0      1   0    0       0
#> 43:               race  0      1   0    0       0
#> 44:               race  0      1   0    0       0
#> 45:               race  0      1   0    0       0
#> 46:               race  0      1   0    0       0
#> 47:               race  0      1   0    0       0
#> 48:               race  0      1   0    0       0
#> 49:     residence_type  1      0   0    0       0
#> 50:     sample_segment  1      0   0    0       0
#> 51:          speed_mph  0      0   0    1       0
#> 52:        travel_date  0      0   1    1       0
#> 53:            trip_id  0      0   0    1       0
#> 54:        trip_weight  0      0   0    1       0
#> 55:         vehicle_id  0      0   0    0       1
#>            shared_name hh person day trip vehicle