Package 'odbr'

Title: Download Data from Brazil's Origin Destination Surveys
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.
Authors: Haydee Svab [aut, cre], Beatriz Milz [aut] , Diego Rabatone Oliveira [aut], Rafael H. M. Pereira [aut]
Maintainer: Haydee Svab <[email protected]>
License: GPL (>=3)
Version: 0.1.0
Built: 2024-11-25 05:40:23 UTC
Source: https://github.com/hsvab/odbr

Help Index


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


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 yyyy. Defaults to 1977.

harmonize

Logical. When FALSE (Default), the function returns the raw data. If TRUE, the function returns harmonized data to the same city, across all the years.

language

Character. The language of data dictionary to be opened. Options include c("pt", "en", "es").

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 yyyy. Defaults to 1977.

harmonize

Logical. When FALSE (Default), the function returns the raw data. If TRUE, the function returns harmonized data to the same city, across all the years.

geometry

Character. The type of spatial data to be opened. Options include c("zone","district", "municipality").

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 yyyy. Defaults to 1977.

harmonize

Logical. When FALSE (Default), the function returns the raw data. If TRUE, the function returns harmonized data to the same city, across all the years.

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
)