read_data | R Documentation |
Read HTS data, weights, metadata, etc.
read_data(study, project_path)
study |
character. A valid study name. |
project_path |
character. The project directory. |
read_data
is a wrapper for reading in variables from the correct csvs
and merging the corresponding tables on correct keys. fread and
merge are used for performance benefits.
read_data returns an object of class "HTS.data". It contains the data files and weights necessary for querying the HTS datasets, used primarily by summarize_data.
The "HTS.data" object is essentially a list of data.tables broken up by data and weights.
Accessing the data:
household - Household data file
person - Person data file
trip - Trip data file
vehicle - Vehicle data file
Accessing the weights:
household - Household weight file. Used for weighting household and vehicle data.
person - Person weight file. Also includes trip weights at the person level.
# Read the data
hts_data <- read_data(
study = 'nirpc_2018',
project_path = 'C:/2018 NIRPC Household Travel Survey'
)
# Access the data
hts_data$data$household # household data
hts_data$data$person # person data
hts_data$data$trip # trip data
hts_data$data$vehicle # vehicle data
# Access the weights
hts_data$weights$household # household weights
hts_data$weights$person # person and trip weights
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.