You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: r-package/vignettes/r5r.Rmd
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: 'Intro to r5r: Rapid Realistic Routing with R5 in R'
3
3
author: "Rafael H. M. Pereira, Marcus Saraiva, Daniel Herszenhut, Carlos Kaue Braga"
4
4
date: "`r Sys.Date()`"
5
5
output: rmarkdown::html_vignette
6
-
abstract: "`r5r` is an R package for rapid realistic routing on multimodal transport networks (walk, bike, public transport and car) using R<sup>5</sup>. The package allows users to generate detailed routing analysis or calculate travel time matrices using seamless parallel computing on top of the R<sup>5</sup> Java machine <https://github.com/conveyal/r5>"
6
+
abstract: "`{r5r}` is an R package for rapid realistic routing on multimodal transport networks (walk, bike, public transport and car) using R<sup>5</sup>. The package allows users to generate detailed routing analysis or calculate travel time matrices using seamless parallel computing on top of the R<sup>5</sup> Java machine <https://github.com/conveyal/r5>"
7
7
urlcolor: blue
8
8
vignette: >
9
9
%\VignetteIndexEntry{Intro to r5r: Rapid Realistic Routing with R5 in R}
Before we start, we need to increase the memory available to Java. This is necessary because, by default, `R` allocates only 512MB of memory for Java processes, which is not enough for large queries using `r5r`. To increase available memory to 2GB, for example, we need to set the `java.parameters` option at the beginning of the script, as follows:
87
+
First, we need to increase the memory available to Java. This has to be done **before** loading the `{r5r}` library because, by default, `R` allocates only 512MB of memory for Java processes, which is not enough for large queries using `{r5r}`. To increase available memory to 2GB, for example, we need to set the `java.parameters` option at the beginning of the script, as follows:
88
88
89
89
```{r, message = FALSE}
90
90
options(java.parameters = "-Xmx2G")
91
91
```
92
92
93
-
Note: It's very important to allocate enough memory before loading `r5r` or any other Java-based package, since `rJava` starts a Java Virtual Machine only once for each R session. It might be useful to restart your R session and execute the code above right after, if you notice that you haven't succeeded in your previous attempts.
93
+
Note: It's very important to allocate enough memory before loading `{r5r}` or any other Java-based package, since `rJava` starts a Java Virtual Machine only once for each R session. It might be useful to restart your R session and execute the code above right after, if you notice that you haven't succeeded in your previous attempts.
94
94
95
95
Then we can load the packages used in this vignette:
96
96
@@ -101,9 +101,9 @@ library(data.table)
101
101
library(ggplot2)
102
102
```
103
103
104
-
The `r5r` package has seven **fundamental functions**:
104
+
The `{r5r}` package has seven **fundamental functions**:
105
105
106
-
1.`setup_r5()` to initialize an instance of `r5r`, that also builds a routable
106
+
1.`setup_r5()` to initialize an instance of `{r5r}`, that also builds a routable
107
107
transport network;
108
108
109
109
2.`accessibility()` for fast computation of access to opportunities considering
@@ -136,7 +136,7 @@ The package also includes a few **support functions**.
136
136
137
137
## 3.1 Data requirements:
138
138
139
-
To use `r5r`, you will need:
139
+
To use `{r5r}`, you will need:
140
140
141
141
- A road network data set from OpenStreetMap in `.pbf` format (*mandatory*)
142
142
- A public transport feed in `GTFS.zip` format (optional)
@@ -161,15 +161,15 @@ Here are a few places from where you can download these data sets:
161
161
- Nasa's SRTMGL1 website
162
162
163
163
164
-
Let's have a quick look at how `r5r` works using a sample data set.
164
+
Let's have a quick look at how `{r5r}` works using a sample data set.
165
165
166
166
167
167
168
168
# 4. Demonstration on sample data
169
169
170
170
## Data
171
171
172
-
To illustrate the functionalities of `r5r`, the package includes a small sample data for the city of Porto Alegre (Brazil). It includes seven files:
172
+
To illustrate the functionalities of `{r5r}`, the package includes a small sample data for the city of Porto Alegre (Brazil). It includes seven files:
173
173
174
174
* An OpenStreetMap network: `poa_osm.pbf`
175
175
* Two public transport feeds: `poa_eptc.zip` and `poa_trensurb.zip`
@@ -206,7 +206,7 @@ head(points)
206
206
207
207
## 4.1 Building routable transport network with `setup_r5()`
208
208
209
-
The first step is to build the multimodal transport network used for routing in R<sup>5</sup>. This is done with the `setup_r5` function. This function does two things: (1) downloads/updates a compiled JAR file of R<sup>5</sup> and stores it locally in the `r5r` package directory for future use; and (2) combines the osm.pbf and gtfs.zip data sets to build a routable network object.
209
+
The first step is to build the multimodal transport network used for routing in R<sup>5</sup>. This is done with the `setup_r5` function. This function does two things: (1) downloads/updates a compiled JAR file of R<sup>5</sup> and stores it locally in the `{r5r}` package directory for future use; and (2) combines the osm.pbf and gtfs.zip data sets to build a routable network object.
210
210
211
211
```{r, message = FALSE}
212
212
# Indicate the path where OSM and GTFS data are stored
`r5r` objects are still allocated to any amount of memory previously set after they are done with their calculations. In order to remove an existing `r5r` object and reallocate the memory it had been using, we use the `stop_r5` function followed by a call to Java's garbage collector, as follows:
378
+
`{r5r}` objects are still allocated to any amount of memory previously set after they are done with their calculations. In order to remove an existing `{r5r}` object and reallocate the memory it had been using, we use the `stop_r5` function followed by a call to Java's garbage collector, as follows:
0 commit comments