А вот код!
library(tidyverse)
library(knitr)
library(httr2)
Rows: 349,753
Columns: 6
$ geom <chr> "LINESTRING (37.081866 54.504539,37.081866 54.50443,37.…
$ from_vertex_id <dbl> 3652, 58925, 58925, 248317, 24102, 52561, 96152, 169402…
$ to_vertex_id <dbl> 3650, 69671, 69510, 248315, 24100, 52559, 96154, 169400…
$ weight <dbl> 1.784126e+16, 4.689159e+16, 6.011167e+16, 1.951298e+16,…
$ was_one_way <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,…
$ group_id <dbl> 42993, NA, NA, NA, 41418, NA, NA, NA, NA, NA, NA, NA, N…
Роутеры
routers <- readr::read_csv2("data/wifi_routers.csv")
routers <- routers %>%
tidyr::separate_wider_delim(geom, delim = " ", names=c("point", "lat", "lon")) %>%
mutate(lat = stringr::str_replace(lat, "\\(","") %>% as.numeric()) %>%
mutate(lon = stringr::str_replace(lon, "\\)","") %>% as.numeric())
routers %>% select(guid, lat, lon)
# A tibble: 29 × 3
guid lat lon
<chr> <dbl> <dbl>
1 0648078a-9d45-4577-af14-12b49e8f017b 37.6 54.2
2 6422a0a5-2c2d-4610-bebc-91722ea37827 37.6 54.2
3 b17aefd3-8431-4054-a0b5-b0a26eeb9f14 37.6 54.2
4 92c1cc9e-cfa4-4ef0-91f0-c0a158f547e7 37.6 54.2
5 f0058c02-034f-429a-b932-8638089d8718 37.6 54.2
6 37cea6a6-eaaa-4e12-9b4b-b444163a2cc8 37.6 54.2
7 07190dec-be71-44a2-8d64-c24fb51ebc7b 37.6 54.2
8 8a823f01-771f-420e-8971-928cba314a24 37.6 54.2
9 8a734674-e451-4fe1-8b50-3b3b46e334a1 37.6 54.2
10 cdcab165-cc3a-460f-ae99-024216190ab1 37.6 54.2
# ℹ 19 more rows
---
title: "Подготовка данных"
execute:
warning: false
error: false
---
## Подготовка рабочего окружения
```{r}
library(tidyverse)
library(knitr)
library(httr2)
```
## Импорт
```{r}
#|eval: false
rd_network <- readr::read_csv2("https://storage.yandexcloud.net/roadgraph/road_network.csv")
glimpse(rd_network)
```
Роутеры
```{r}
routers <- readr::read_csv2("data/wifi_routers.csv")
routers <- routers %>%
tidyr::separate_wider_delim(geom, delim = " ", names=c("point", "lat", "lon")) %>%
mutate(lat = stringr::str_replace(lat, "\\(","") %>% as.numeric()) %>%
mutate(lon = stringr::str_replace(lon, "\\)","") %>% as.numeric())
routers %>% select(guid, lat, lon)
```
### Расстояния
```{r}
#|eval: false
library(httr2)
httr2::request("https://graphhopper.com/api/1/route") %>%
req_method("POST")
```