Skip to content

Commit 934c4ac

Browse files
committed
minor updates to README and intro vignette
1 parent f3606fd commit 934c4ac

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@ This repository contains the `R` code (r-package folder) and the Java code
2727
You can install `r5r`:
2828

2929
```R
30-
# From CRAN
31-
install.packages("r5r")
32-
library(r5r)
30+
# from CRAN
31+
install.packages("r5r")
3332

34-
# or use the development version with latest features
35-
utils::remove.packages('r5r')
36-
devtools::install_github("ipeaGIT/r5r", subdir = "r-package")
37-
library(r5r)
33+
# dev version with latest features
34+
utils::remove.packages('r5r')
35+
devtools::install_github("ipeaGIT/r5r", subdir = "r-package")
3836

3937
```
4038

@@ -147,11 +145,12 @@ and Open Street Map networks of Porto Alegre (Brazil). Three steps are required
147145
use `r5r`, as follows.
148146

149147
```R
150-
# allocate RAM memory to Java
148+
# allocate RAM memory to Java **before** loading the {r5r} library
151149
options(java.parameters = "-Xmx2G")
152150

153-
# 1) build transport network, pointing to the path where OSM and GTFS data are stored
154151
library(r5r)
152+
153+
# 1) build transport network, pointing to the path where OSM and GTFS data are stored
155154
path <- system.file("extdata/poa", package = "r5r")
156155
r5r_core <- setup_r5(data_path = path, verbose = FALSE)
157156

r-package/vignettes/r5r.Rmd

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: 'Intro to r5r: Rapid Realistic Routing with R5 in R'
33
author: "Rafael H. M. Pereira, Marcus Saraiva, Daniel Herszenhut, Carlos Kaue Braga"
44
date: "`r Sys.Date()`"
55
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>"
77
urlcolor: blue
88
vignette: >
99
%\VignetteIndexEntry{Intro to r5r: Rapid Realistic Routing with R5 in R}
@@ -41,19 +41,19 @@ https://doi.org/10.32866/001c.21262).
4141

4242
# 2. Installation
4343

44-
You can install `r5r` from CRAN, or the development version from github.
44+
You can install `{r5r}` from CRAN, or the development version from github.
4545

4646
```{r, eval = FALSE}
47-
# CRAN
47+
# from CRAN
4848
install.packages('r5r')
4949
50-
# dev version on github
50+
# dev version with latest features
5151
devtools::install_github("ipeaGIT/r5r", subdir = "r-package")
5252
```
5353

5454

5555
Please bear in mind that you need to have *Java Development Kit (JDK) 21* installed
56-
on your computer to use `r5r`. No worries, you don't have to pay for it. There are
56+
on your computer to use `{r5r}`. No worries, you don't have to pay for it. There are
5757
numerous open-source JDK implementations, and you only need to install one JDK. Here are a few options:
5858

5959
- [Adoptium/Eclipse Temurin](https://adoptium.net/) (our preferred option)
@@ -84,13 +84,13 @@ rJavaEnv::java_check_version_rjava()
8484

8585
# 3. Usage
8686

87-
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:
8888

8989
```{r, message = FALSE}
9090
options(java.parameters = "-Xmx2G")
9191
```
9292

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.
9494

9595
Then we can load the packages used in this vignette:
9696

@@ -101,9 +101,9 @@ library(data.table)
101101
library(ggplot2)
102102
```
103103

104-
The `r5r` package has seven **fundamental functions**:
104+
The `{r5r}` package has seven **fundamental functions**:
105105

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
107107
transport network;
108108

109109
2. `accessibility()` for fast computation of access to opportunities considering
@@ -136,7 +136,7 @@ The package also includes a few **support functions**.
136136

137137
## 3.1 Data requirements:
138138

139-
To use `r5r`, you will need:
139+
To use `{r5r}`, you will need:
140140

141141
- A road network data set from OpenStreetMap in `.pbf` format (*mandatory*)
142142
- 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:
161161
- Nasa's SRTMGL1 website
162162

163163

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.
165165

166166

167167

168168
# 4. Demonstration on sample data
169169

170170
## Data
171171

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:
173173

174174
* An OpenStreetMap network: `poa_osm.pbf`
175175
* Two public transport feeds: `poa_eptc.zip` and `poa_trensurb.zip`
@@ -206,7 +206,7 @@ head(points)
206206

207207
## 4.1 Building routable transport network with `setup_r5()`
208208

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.
210210

211211
```{r, message = FALSE}
212212
# Indicate the path where OSM and GTFS data are stored
@@ -375,7 +375,7 @@ knitr::include_graphics("https://github.com/ipeaGIT/r5r/blob/master/r-package/in
375375

376376
### Cleaning up after usage
377377

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:
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:
379379

380380
```{r, message = FALSE}
381381
r5r::stop_r5(r5r_core)

0 commit comments

Comments
 (0)