This vignette introduces the
aopdata
package.
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.
The 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.
The aopdata package includes five core functions.
read_population()
- Download population dataread_landuse()
- Download landuse dataread_access()
- Download accessibility estimatesaopdata_dictionary()
- Opens aopdata data dictionary on
a web browserread_grid()
- Download the H3 hexagonal spatial
gridFor a detailed explanations of these functions, check the vignettes: - Mapping urban accessibility - Mapping population data - Mapping land use data - Analyzing inequality in access to opportunities
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:
The read_access()
function downloads accessibility
estimates for a given city
, mode
and
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 public_transport
and car
modes.
# Download accessibility, population and land use data
cur <- read_access(
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.
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.
In case you would like to download only the H3 spatial grid of cities
in the AOP project, you can use the read_grid()
function.
h3_for <- read_grid(city = 'Fortaleza', showProgress = FALSE)
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:
city
parameter can also be a 3-letter abbreviation
of the city.df <- read_access(city = 'cur',
mode = 'public_transport',
year = 2019,
peak = TRUE,
showProgress = FALSE)
df <- read_grid(city = 'for', showProgress = FALSE)
city = '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
Accessibility data