Last active
November 8, 2023 08:20
-
-
Save joelgombin/e1c8aaa746c40cd77f422b30d13912cf to your computer and use it in GitHub Desktop.
French main streams according to Wikidata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(WikidataR) | |
library(glitter) | |
library(tidyverse) | |
find_item("main stream") | |
fleuves <- spq_init() %>% | |
spq_add("?items wdt:P31 wd:Q573344") %>% | |
spq_add("?items wdt:P17 wd:Q142") %>% | |
spq_add("?items wdt:P403 ?mouth") %>% | |
spq_add("?items wdt:P2043 ?length") %>% | |
spq_label(items, .languages = "fr") %>% | |
spq_label(mouth, .languages = "fr") %>% | |
spq_perform() | |
riviere_fleuves <- spq_init() %>% | |
spq_add("?items wdt:P31 wd:Q4022") %>% | |
spq_add("?items wdt:P17 wd:Q142") %>% | |
spq_add("?items wdt:P403 ?mouth") %>% | |
spq_add("?mouth wdt:P31 wd:Q165") %>% | |
spq_add("?items wdt:P2043 ?length") %>% | |
spq_label(items, .languages = "fr") %>% | |
spq_label(mouth, .languages = "fr") %>% | |
spq_perform() | |
fleuves |> | |
bind_rows(riviere_fleuves) |> | |
select(items, items_label, mouth_label, length) |> | |
distinct(items, .keep_all = TRUE) |> | |
arrange(desc(length)) |> | |
View() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment