-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathREADME.Rmd
139 lines (114 loc) · 4.4 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# accessibility <img align="right" src="man/figures/logo.png" alt="logo" width="180">
[![CRAN
status](https://www.r-pkg.org/badges/version/accessibility)](https://CRAN.R-project.org/package=accessibility)
[![rcmdcheck](https://github.com/ipeaGIT/accessibility/workflows/rcmdcheck/badge.svg)](https://github.com/ipeaGIT/accessibility/actions)
[![CRAN/METACRAN Total
downloads](https://cranlogs.r-pkg.org/badges/grand-total/accessibility?color=yellow)](https://CRAN.R-project.org/package=accessibility)
[![Codecov test
coverage](https://codecov.io/gh/ipeaGIT/accessibility/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ipeaGIT/accessibility?branch=main)
[![Lifecycle:
stable](https://lifecycle.r-lib.org/articles/figures/lifecycle-stable.svg)](https://lifecycle.r-lib.org/articles/stages.html)
**accessibility** offers a set of fast and convenient functions to help
conducting accessibility analyses. Given a pre-computed travel cost matrix and a
land use dataset (containing the location of jobs, healthcare and population,
for example), the package allows one to calculate accessibility levels and
accessibility poverty and inequality. The package covers the majority of the
most commonly used accessibility measures (such as cumulative opportunities,
gravity-based and floating catchment areas methods), as well as the most
frequently used inequality and poverty metrics (such as the Palma ratio, the
concentration and Theil indices and the FGT family of measures).
## Installation
Stable version:
```{r, eval = FALSE}
install.packages("accessibility")
```
Development version:
```{r, eval = FALSE}
# install.packages("remotes")
remotes::install_github("ipeaGIT/accessibility")
```
## Usage
This section aims to present a very brief overview of some of the packages'
features. Fore more details please read the vignettes:
- [Introduction to **accessibility**: calculating accessibility
measures](https://ipeagit.github.io/accessibility/articles/accessibility.html)
- [Decay
functions](https://ipeagit.github.io/accessibility/articles/decay_functions.html)
- [Calculating accessibility inequality and
poverty](https://ipeagit.github.io/accessibility/articles/inequality_and_poverty.html)
To calculate accessibility levels, one simply needs a pre-calculated travel
matrix and some land use data. Below we showcase some of the available
functions:
```{r}
library(accessibility)
data_dir <- system.file("extdata", package = "accessibility")
travel_matrix <- readRDS(file.path(data_dir, "travel_matrix.rds"))
land_use_data <- readRDS(file.path(data_dir, "land_use_data.rds"))
cum_cutoff <- cumulative_cutoff(
travel_matrix,
land_use_data,
opportunity = "jobs",
travel_cost = "travel_time",
cutoff = 30
)
head(cum_cutoff)
grav <- gravity(
travel_matrix,
land_use_data,
opportunity = "schools",
travel_cost = "travel_time",
decay_function = decay_exponential(decay_value = 0.2)
)
head(grav)
fca <- floating_catchment_area(
travel_matrix,
land_use_data,
opportunity = "jobs",
travel_cost = "travel_time",
demand = "population",
method = "2sfca",
decay_function = decay_binary(cutoff = 50)
)
head(fca)
```
Calculating inequality and poverty levels is equally easy. Below we use the
previously calculated cumulative accessibility dataset to show some of the
available inequality and poverty functions:
```{r}
palma <- palma_ratio(
cum_cutoff,
sociodemographic_data = land_use_data,
opportunity = "jobs",
population = "population",
income = "income_per_capita"
)
palma
poverty <- fgt_poverty(
cum_cutoff,
sociodemographic_data = land_use_data,
opportunity = "jobs",
population = "population",
poverty_line = 95368
)
poverty
```
## Related work:
- [r5r](https://github.com/ipeaGIT/r5r): Rapid Realistic Routing with R5 in R
- [tracc](https://github.com/jamaps/tracc): Transport accessibility measures in
Python
- [access](https://access.readthedocs.io/en/latest/): Spatial Access for PySAL
- [aceso](https://github.com/tetraptych/aceso): a lightweight Python package for
measuring spatial accessibility
## Acknowledgement <a href="https://www.ipea.gov.br"><img src="man/figures/ipea_logo.png" alt="IPEA" align="right" width="300"/></a>
**accessibility** is developed by a team at the Institute for Applied Economic Research (Ipea), Brazil.