diff --git a/R/spq_group_by.R b/R/spq_group_by.R index d0782623..579f5515 100644 --- a/R/spq_group_by.R +++ b/R/spq_group_by.R @@ -4,13 +4,13 @@ #' @return A query object #' @export #' @examples -#' \dontrun{ #' spq_init() %>% -#' spq_add("?s a ?class") %>% -#' spq_group_by(class) %>% -#' spq_head(n=3) %>% -#' spq_perform() -#' } +#' spq_add("?item wdt:P361 wd:Q297853") %>% +#' spq_add("?item wdt:P1082 ?folkm_ngd") %>% +#' spq_add("?area wdt:P31 wd:Q1907114", .label = "?area") %>% +#' spq_add("?area wdt:P527 ?item") %>% +#' spq_group_by(area, areaLabel) %>% +#' spq_summarise(total_folkm = sum(folkm_ngd)) spq_group_by = function(.query, ...){ vars = purrr::map_chr(rlang::enquos(...), spq_treat_argument) diff --git a/man/spq_group_by.Rd b/man/spq_group_by.Rd index e2249820..03b903a7 100644 --- a/man/spq_group_by.Rd +++ b/man/spq_group_by.Rd @@ -18,11 +18,11 @@ A query object Group the results by one or more variables } \examples{ -\dontrun{ spq_init() \%>\% -spq_add("?s a ?class") \%>\% -spq_group_by(class) \%>\% -spq_head(n=3) \%>\% -spq_perform() -} +spq_add("?item wdt:P361 wd:Q297853") \%>\% +spq_add("?item wdt:P1082 ?folkm_ngd") \%>\% +spq_add("?area wdt:P31 wd:Q1907114", .label = "?area") \%>\% +spq_add("?area wdt:P527 ?item") \%>\% +spq_group_by(area, areaLabel) \%>\% +spq_summarise(total_folkm = sum(folkm_ngd)) }