-
Notifications
You must be signed in to change notification settings - Fork 6
/
script_carto.R
55 lines (41 loc) · 1.49 KB
/
script_carto.R
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
library(tidyverse)
carnets <- read_tsv("../data/coordonnees-carnets.csv",
col_types = cols(
.default = col_character(),
`Date de mise en ligne` = col_date(format = ""),
`Membre responsable` = col_integer(),
`Membre responsable_1` = col_integer(),
`Membre responsable_2` = col_integer(),
`Membre responsable_3` = col_integer(),
`Membre responsable_4` = col_integer(),
`Membre responsable_5` = col_integer()
))
library(banR)
carnets <- carnets %>%
filter(!is.na(`Code INSEE Ville Adresse`)) %>%
ban_geocode(Adresse, code_insee = "`Code INSEE Ville Adresse`")
library(sp)
carnets <- carnets %>%
filter(!is.na(latitude)) %>%
filter(latitude > 0) %>%
filter(result_score > 0.5)
coordinates(carnets) <- c("longitude", "latitude")
proj4string(carnets) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
library(mapview)
mapview(carnets)
library(tmap)
library(tmaptools)
library(OpenStreetMap)
# fonds_osm <- read_osm(carnets)
library(spdplyr)
carnets <- carnets %>%
mutate(Langue = stringr::str_sub(Langue, 1, 2))
# tm_shape(fonds_osm) +
# tm_raster() +
carte <- tm_shape(carnets) +
tm_bubbles(col = "Langue", size = 0.3, alpha = 0.5, palette = "Set1") +
tm_legend(legend.outside = TRUE, legend.outside.position = "left")
tmap_mode(mode = "view")
carte
tmap_mode(mode = "plot")
carte