Title: | Download Data from Brazil's Origin Destination Surveys |
Version: | 0.1.1 |
Description: | Download data from Brazil's Origin Destination Surveys. The package covers both data from household travel surveys, dictionaries of variables, and the spatial geometries of surveys conducted in different years and across various urban areas in Brazil. For some cities, the package will include enhanced versions of the data sets with variables "harmonized" across different years. |
License: | GPL (≥ 3) |
Depends: | R (≥ 2.10) |
Imports: | cli, data.table, fs, haven, piggyback, R.utils, sf |
Suggests: | knitr, rmarkdown, spelling, testthat (≥ 3.2.0) |
VignetteBuilder: | knitr |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.3.2 |
URL: | https://hsvab.github.io/odbr/, https://github.com/hsvab/odbr |
BugReports: | https://github.com/hsvab/odbr/issues |
Language: | en-US |
NeedsCompilation: | no |
Packaged: | 2025-02-13 12:22:23 UTC; hsvab |
Author: | Haydee Svab [aut, cre],
Beatriz Milz |
Maintainer: | Haydee Svab <hsvab@hsvab.eng.br> |
Repository: | CRAN |
Date/Publication: | 2025-02-14 14:50:07 UTC |
Sao Paulo OD Survey Dictionary
Description
These datasets contain the dictionary for the OD surveys in Sao Paulo. Each row describes one column of the survey data frame.
Usage
od_sao_paulo_1977_not_harmonized_dictionary_en
od_sao_paulo_1977_not_harmonized_dictionary_es
od_sao_paulo_1977_not_harmonized_dictionary_pt
od_sao_paulo_1987_not_harmonized_dictionary_en
od_sao_paulo_1987_not_harmonized_dictionary_es
od_sao_paulo_1987_not_harmonized_dictionary_pt
od_sao_paulo_1997_not_harmonized_dictionary_en
od_sao_paulo_1997_not_harmonized_dictionary_es
od_sao_paulo_1997_not_harmonized_dictionary_pt
od_sao_paulo_2007_not_harmonized_dictionary_en
od_sao_paulo_2007_not_harmonized_dictionary_es
od_sao_paulo_2007_not_harmonized_dictionary_pt
od_sao_paulo_2017_not_harmonized_dictionary_en
od_sao_paulo_2017_not_harmonized_dictionary_es
od_sao_paulo_2017_not_harmonized_dictionary_pt
Format
A data frame with 4 columns:
- variable_name
Name of the variable
- description
Description of the variable
- categories
Examples of the categories in the variable
- class
Class of the variable
An object of class data.table
(inherits from data.frame
) with 76 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 76 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 93 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 93 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 93 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 110 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 76 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 110 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 124 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 76 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 124 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 128 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 76 rows and 4 columns.
An object of class data.table
(inherits from data.frame
) with 128 rows and 4 columns.
Source
https://transparencia.metrosp.com.br/dataset/pesquisa-origem-e-destino
Download file from odbr using piggyback
Description
Download file from odbr using piggyback
Usage
download_piggyback(filename_to_download)
Arguments
filename_to_download |
String. The name of the file to be downloaded. |
Value
A string with the path to the file saved in a tempdir
Metadata for the package
Description
This dataset has the list of OD surveys available in the package.
Usage
metadata
Format
metadata
A data frame with 4 columns:
- city
City name
- year
Year of the survey
- harmonized
A logical value showing whether the dataset was harmonized
- language
Language of the dictionary
Download data dictionary from OD surveys databases
Description
Return the data dictionary of a specific Origin
Destination Survey, if available. This dictionary is intended to be used to
understand the data downloaded using the odbr::read_od
function. It will
contain the list of variables and, for each variable, a simple description,
the available categories and its class (factor, numeric, etc).
Usage
read_dictionary(
city = "São Paulo",
year = 2017,
harmonize = FALSE,
language = "pt"
)
Arguments
city |
Character. City of reference. Defaults to "São Paulo". |
year |
Numeric. Year of reference in the format |
harmonize |
Logical. When |
language |
Character. The language of data dictionary to be opened.
Options include |
Value
A "data.frame"
object.
Examples
library(odbr)
# return data dictionary from OD Surveys, as data.frame, at a given city and year
df <- read_dictionary(
city = "Sao Paulo",
year = 2017,
harmonize = FALSE,
language = "pt"
)
Download spatial data from OD Surveys databases
Description
read_map()
download the geodetic data for a specific Origin Destination survey
and return it as an sf dataframe. It uses the cached data file if it was
previously downloaded to avoid extra networking consumption. To understand
the returned dataframe format, please reefer to the read_dictionary()
function for the same survey cohort.
It is also necessary to specify the geometry granularity wanted, be it
"municipality", "district" or "zone" level of details. Of course, not all
geometries are available for all surveys.
Usage
read_map(city = "São Paulo", year = 2017, harmonize = FALSE, geometry = "zone")
Arguments
city |
Character. City of reference. Defaults to "São Paulo". |
year |
Numeric. Year of reference in the format |
harmonize |
Logical. When |
geometry |
Character. The type of spatial data to be opened. Options
include |
Value
An "sf" "data.frame"
object
Examples
library(odbr)
# return zone data from OD Surveys database as sf object at a given city and year
df <- read_map(
city = "Sao Paulo",
year = 2017,
harmonize = FALSE,
geometry = "zone"
)
#' # return district data from OD Surveys database as sf object at a given city and year
df <- read_map(
city = "Sao Paulo",
year = 2017,
harmonize = FALSE,
geometry = "district"
)
# return municipality data from OD Surveys database as sf object at a given city and year
df <- read_map(
city = "Sao Paulo",
year = 2017,
harmonize = FALSE,
geometry = "municipality"
)
Download microdata from OD Surveys databases
Description
read_od()
download the data for a specific Origin Destination survey and
return it as a dataframe. It uses the cached data file if it was previously
downloaded to avoid extra networking consumption. To understand the returned
dataframe format, please reefer to the read_dictionary()
function for the
same survey cohort.
Usage
read_od(city = "São Paulo", year = 2017, harmonize = FALSE)
Arguments
city |
Character. City of reference. Defaults to "São Paulo". |
year |
Numeric. Year of reference in the format |
harmonize |
Logical. When |
Value
A "data.frame"
object.
Examples
library(odbr)
# return data from OD Surveys database as data.frame
df <- read_od(
city = "Sao Paulo",
year = 2017,
harmonize = FALSE
)