spq_group_by | R Documentation |
Group the results by one or more variables
spq_group_by(.query, ...)
.query |
query |
... |
Either R-DSL or strings with variable names |
A query object
spq_init() %>%
spq_add("?item wdt:P361 wd:Q297853") %>%
spq_add("?item wdt:P1082 ?folkm_ngd") %>%
spq_add("?area wdt:P31 wd:Q1907114") %>%
spq_label(area) %>%
spq_add("?area wdt:P527 ?item") %>%
spq_group_by(area, area_label) %>%
spq_summarise(total_folkm = sum(folkm_ngd))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.