Skip to content

Commit 23bb278

Browse files
committed
Update Limerick example, close #5
Heads-up @joeytalbot on an alternative way to replace NA values
1 parent 5fdcb09 commit 23bb278

File tree

4 files changed

+1679
-1680
lines changed

4 files changed

+1679
-1680
lines changed

R/rnetvis.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#' # Small variations in line width
1818
#' netvis(rnet, min_width = 3, max_width = 10)
1919
#' rnet = rnet_limerick
20-
#' netvis(rnet_limerick, width_regex = "Bicycle")
20+
#' netvis(rnet, width_regex = "Bicycle")
2121
netvis = function(
2222
rnet,
2323
min_width = 1,

README.qmd

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ The goal of this repo is to demonstrate different visualisation techniques for c
3434
```{r, eval = FALSE, echo=FALSE}
3535
# install.packages("devtools")
3636
# devtools::install_github("ITSLeeds/netvis")
37+
library(tidyverse)
3738
```
3839

3940
# Example data
@@ -50,18 +51,16 @@ This is imported and plotted with code shown below.
5051
#| echo: false
5152
u = "https://cruse.bike/limerick/rnet_combined_balanced.gpkg"
5253
rnet_limerick_balanced_full = sf::read_sf(u)
54+
# Make numeric cols numerics not chars:
55+
# To do this, values of "1-10" need to be changed to 3 (or another integer)
56+
rnet_limerick_balanced_full = rnet_limerick_balanced_full |>
57+
mutate(across(starts_with("Bic"), as.numeric)) |>
58+
mutate(across(starts_with("Bic"), replace_na, replace = 3))
5359
zones_limerick = zonebuilder::zb_zone("limerick")
5460
central_limerick = zones_limerick |>
5561
dplyr::filter(circle_id == 1) |>
5662
sf::st_union()
5763
rnet_limerick = sf::st_intersection(rnet_limerick_balanced_full, central_limerick)
58-
# Make numeric cols numerics not chars:
59-
# To do this, values of "1-10" need to be changed to 3 (or another integer)
60-
rnet_limerick$`Bicycle (Baseline)` = gsub("1-10", 3, rnet_limerick$`Bicycle (Baseline)`)
61-
rnet_limerick$`Bicycle (Near market)` = gsub("1-10", 3, rnet_limerick$`Bicycle (Near market)`)
62-
rnet_limerick$`Bicycle (Climate action plan)` = gsub("1-10", 3, rnet_limerick$`Bicycle (Climate action plan)`)
63-
rnet_limerick$`Bicycle (Go Dutch)` = gsub("1-10", 3, rnet_limerick$`Bicycle (Go Dutch)`)
64-
rnet_limerick$`Bicycle (Ebike)` = gsub("1-10", 3, rnet_limerick$`Bicycle (Ebike)`)
6564
6665
rnet_limerick = rnet_limerick |>
6766
mutate(across(c(`Bicycle (Baseline)`:`Bicycle (Ebike)`), ~as.numeric(.)))

data/rnet_limerick.rda

35.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)