This vignette introduces the
aopdata is an R package to download
data from the Access to
Opportunities Project (AOP). The AOP is a research initiative led by
the Institute for Applied Economic Research (Ipea) with the aim to study
transport access to opportunities in Brazilian cities.
aopdata package brings annual
estimates of access to employment, health, education and social
protection services by transport mode at a fine spatial resolution for
the 20 largest cities in Brazil. The package also brings data on the
spatial distribution of population by sex, race, income and age, as well
as the distribution of jobs, schools, healthcare facilities and social
assistance reference centers.
Data for 2017, 2018 and 2019 are already available, and cover accessibility estimates by car and active transport modes (walking and cycling) for the 20 largest cities in the country, and by public transport for over 9 major cities. For more information on the AOP website.
You can install
aopdata from CRAN, or the development
version from GitHub.
# CRAN install.packages("aopdata") # dev version from github ::remove.packages('aopdata') utils::install_github("ipeaGIT/aopdata", subdir = "r-package")devtools
The aopdata package includes five core functions.
read_population()- Download population data
read_landuse()- Download landuse data
read_access()- Download accessibility estimates
aopdata_dictionary()- Opens aopdata data dictionary on a web browser
read_grid()- Download the H3 hexagonal spatial grid
First, you need to load the package.
The dictionary of data columns is presented in the documentation of each function. However, you can also open the data dictionary on a web browser by running:
# for English aopdata_dictionary(lang = 'en') # for Portuguese aopdata_dictionary(lang = 'pt')
read_access() function downloads accessibility
estimates for a given
year. For the sake of convenience, this function will also
automatically download the population and land use data for the cities
selected. Note that accessibility estimates are available for peak and
off-peak periods for
# Download accessibility, population and land use data <- read_access( cur city = 'Curitiba', mode = 'public_transport', peak = TRUE, year = 2019, showProgress = FALSE )
You many also set the parameter
geometry = TRUE so that
functions return a spatial
sf object with the geometries of
the H3 spatial grid.
# Download accessibility, population and land use data <- read_access( cur city = 'Curitiba', mode = 'public_transport', peak = TRUE, year = 2019, geometry = TRUE )
In case you are only interested in using the population and land use data generated by the Access to Opportunities Project, you can download these data sets separately. Please note that the population available comes from the latest Brazilian 2010 census, while land use data cna be downloaded for 2017, 2018 or 2019.
# Land use data <- read_landuse( lnu_for city = 'Fortaleza', year = 2019, geometry = TRUE, showProgress = FALSE ) # Population data <- read_population( pop_for city = 'Fortaleza', year = 2010, geometry = TRUE, showProgress = FALSE )
In case you would like to download only the H3 spatial grid of cities
in the AOP project, you can use the
<- read_grid(city = 'Fortaleza', showProgress = FALSE) h3_for head(h3_for) #> Simple feature collection with 6 features and 4 fields #> Geometry type: POLYGON #> Dimension: XY #> Bounding box: xmin: -38.50828 ymin: -3.889301 xmax: -38.4983 ymax: -3.878958 #> Geodetic CRS: WGS 84 #> id_hex abbrev_muni name_muni code_muni #> 1 89801040323ffff for Fortaleza 2304400 #> 2 89801040327ffff for Fortaleza 2304400 #> 3 8980104032bffff for Fortaleza 2304400 #> 4 8980104032fffff for Fortaleza 2304400 #> 5 89801040333ffff for Fortaleza 2304400 #> 6 89801040337ffff for Fortaleza 2304400 #> geom #> 1 POLYGON ((-38.50232 -3.8858... #> 2 POLYGON ((-38.50527 -3.8840... #> 3 POLYGON ((-38.49932 -3.8841... #> 4 POLYGON ((-38.50227 -3.8824... #> 5 POLYGON ((-38.50237 -3.8893... #> 6 POLYGON ((-38.50532 -3.8875...
In all of the functions above, note that:
cityparameter can also be a 3-letter abbreviation of the city.
<- read_access(city = 'cur', df mode = 'public_transport', year = 2019, peak = TRUE, showProgress = FALSE) <- read_grid(city = 'for', showProgress = FALSE)df
city = 'all':
<- read_landuse(city = 'all', year = 2019)all
The R package aopdata is developed by a team at the Institute for Applied Economic Research (Ipea), Brazil.
If you use this package in your own work, please cite it as one of the publications below:
Population and land use data