From f1fec23983fc5fc4a2e4795fbe351090100e143a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Thu, 12 Oct 2023 13:52:38 +0200 Subject: [PATCH] fix example --- R/spq_select.R | 15 +++++++++++++-- man/spq_select.Rd | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/R/spq_select.R b/R/spq_select.R index 693276b5..518e784a 100644 --- a/R/spq_select.R +++ b/R/spq_select.R @@ -6,8 +6,19 @@ #' @export #' @examples #' -#' query = spq_init() -#' spq_select(query, count = n (human), eyecolor_label, haircolor_label) +#' spq_init() |> +#' spq_prefix(prefixes = c(dct = "http://purl.org/dc/terms/")) |> +#' spq_add(spq('?lexemeId dct:language wd:Q1860')) |> +#' spq_mutate(lemma = wikibase::lemma(lexemeId)) |> +#' spq_filter(str_detect(lemma, '^pota.*')) |> +#' spq_select(- lemma) +#' +#' spq_init() |> +#' spq_prefix(prefixes = c(dct = "http://purl.org/dc/terms/")) |> +#' spq_add(spq('?lexemeId dct:language wd:Q1860')) |> +#' spq_mutate(lemma = wikibase::lemma(lexemeId)) |> +#' spq_filter(str_detect(lemma, '^pota.*')) |> +#' spq_select(lemma) spq_select = function(.query = NULL, ..., .spq_duplicate = NULL){ if (!is.null(.spq_duplicate)) { original_spq_duplicate = .spq_duplicate diff --git a/man/spq_select.Rd b/man/spq_select.Rd index 858dc573..d0a19ab6 100644 --- a/man/spq_select.Rd +++ b/man/spq_select.Rd @@ -23,6 +23,17 @@ Select (and create) particular variables } \examples{ -query = spq_init() -spq_select(query, count = n (human), eyecolor_label, haircolor_label) +spq_init() |> + spq_prefix(prefixes = c(dct = "http://purl.org/dc/terms/")) |> + spq_add(spq('?lexemeId dct:language wd:Q1860')) |> + spq_mutate(lemma = wikibase::lemma(lexemeId)) |> + spq_filter(str_detect(lemma, '^pota.*')) |> + spq_select(- lemma) + +spq_init() |> + spq_prefix(prefixes = c(dct = "http://purl.org/dc/terms/")) |> + spq_add(spq('?lexemeId dct:language wd:Q1860')) |> + spq_mutate(lemma = wikibase::lemma(lexemeId)) |> + spq_filter(str_detect(lemma, '^pota.*')) |> + spq_select(lemma) }