| spq_tally | R Documentation | 
These functions are inspired by dplyr::count() and dplyr::tally().
spq_tally() assumes you've already done the grouping.
spq_tally(.query, sort = FALSE, name = "n")
spq_count(.query, ..., sort = FALSE, name = "n")
.query | 
 a list with elements of the query  | 
sort | 
 If   | 
name | 
 Name for the count column (like the   | 
... | 
 variables by which to arrange
(or SPARQL strings escaped with   | 
A query object
## Not run: 
spq_init() %>%
spq_add("?film wdt:P31 wd:Q11424") %>%
spq_mutate(narrative_location = wdt::P840(film)) %>%
spq_label(narrative_location) %>%
spq_tally(name = "n_films") %>%
spq_perform()
# the same with spq_count
spq_init() %>%
spq_add("?film wdt:P31 wd:Q11424") %>%
spq_mutate(narrative_location = wdt::P840(film)) %>%
spq_label(narrative_location) %>%
spq_count(name = "n_films") %>%
spq_perform()
# Now with grouping
spq_init() %>%
spq_add("?film wdt:P31 wd:Q11424") %>%
spq_mutate(narrative_location = wdt::P840(film)) %>%
spq_label(film, narrative_location) %>%
spq_group_by(narrative_location_label) %>%
spq_tally(sort = TRUE, name = "n_films") %>%
spq_perform()
# More direct with spq_count()
spq_init() %>%
spq_add("?film wdt:P31 wd:Q11424") %>%
spq_mutate(narrative_location = wdt::P840(film)) %>%
spq_label(film, narrative_location) %>%
spq_count(narrative_location_label, sort = TRUE, name = "n_films") %>%
spq_perform()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.