Use \dontrun instead of \donttest for non-essential examples
This is not so nice for the user experience because of the
wrappers arround examples:
## Not run
...
## End(Not run)
but it is necessary to some extent to pass automatic CRAN
checks under all circumstances, which actually do run
the donttest examples since R 4.0 with a time limit of apparently
20min in total.
Change-Id: If09b1aa381e26179ec1a36edd9d8b07116e3c33e
diff --git a/R/KorAPConnection.R b/R/KorAPConnection.R
index 0919d4e..243e179 100644
--- a/R/KorAPConnection.R
+++ b/R/KorAPConnection.R
@@ -44,13 +44,15 @@
#' [corpusQuery()]
#'
#' @examples
-#' \donttest{
+#' \dontrun{
+#'
#' kcon <- new("KorAPConnection", verbose = TRUE)
#' kq <- corpusQuery(kcon, "Ameisenplage")
#' kq <- fetchAll(kq)
#' }
#'
#' \dontrun{
+#'
#' kcon <- new("KorAPConnection", verbose = TRUE, accessToken="e739u6eOzkwADQPdVChxFg")
#' kq <- corpusQuery(kcon, "Ameisenplage", metadataOnly=FALSE)
#' kq <- fetchAll(kq)
@@ -95,6 +97,7 @@
#' @export
#' @examples
#' \dontrun{
+#'
#' kco <- new("KorAPConnection", accessToken="e739u6eOzkwADQPdVChxFg")
#' persistAccessToken(kco)
#' }
@@ -115,6 +118,7 @@
#' @export
#' @examples
#' \dontrun{
+#'
#' kco <- new("KorAPConnection")
#' clearAccessToken(kco)
#' }
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index e6f240e..9bab575 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -99,20 +99,25 @@
#' Please make sure to check `$collection$rewrites` to see if any unforeseen access rewrites of the query's virtual corpus had to be performed.
#'
#' @examples
+#' \dontrun{
+#'
#' # Fetch metadata of every query hit for "Ameisenplage" and show a summary
-#' \donttest{
#' new("KorAPConnection") %>% corpusQuery("Ameisenplage") %>% fetchAll()
#' }
#'
+#' \dontrun{
+#'
#' # Use the copy of a KorAP-web-frontend URL for an API query of "Ameise" in a virtual corpus
#' # and show the number of query hits (but don't fetch them).
#'
#' new("KorAPConnection", verbose = TRUE) %>%
#' corpusQuery(KorAPUrl =
#' "https://korap.ids-mannheim.de/?q=Ameise&cq=pubDate+since+2017&ql=poliqarp")
+#' }
+#'
+#' \dontrun{
#'
#' # Plot the time/frequency curve of "Ameisenplage"
-#' \donttest{
#' new("KorAPConnection", verbose=TRUE) %>%
#' { . ->> kco } %>%
#' corpusQuery("Ameisenplage") %>%
@@ -224,7 +229,9 @@
#' @return The `kqo` input object with updated slots `collectedMatches`, `apiResponse`, `nextStartIndex`, `hasMoreMatches`
#'
#' @examples
-#' \donttest{q <- new("KorAPConnection") %>% corpusQuery("Ameisenplage") %>% fetchNext()
+#' \dontrun{
+#'
+#' q <- new("KorAPConnection") %>% corpusQuery("Ameisenplage") %>% fetchNext()
#' q@collectedMatches
#' }
#'
@@ -321,7 +328,8 @@
#' **`fetchAll`** fetches all results of a KorAP query.
#'
#' @examples
-#' \donttest{
+#' \dontrun{
+#'
#' q <- new("KorAPConnection") %>% corpusQuery("Ameisenplage") %>% fetchAll()
#' q@collectedMatches
#' }
@@ -336,7 +344,8 @@
#' Fetches the remaining results of a KorAP query.
#'
#' @examples
-#' \donttest{
+#' \dontrun{
+#'
#' q <- new("KorAPConnection") %>% corpusQuery("Ameisenplage") %>% fetchRest()
#' q@collectedMatches
#' }
@@ -358,7 +367,8 @@
#' @aliases frequencyQuery
#' @rdname KorAPQuery-class
#' @examples
-#' \donttest{
+#' \dontrun{
+#'
#' new("KorAPConnection", verbose = TRUE) %>%
#' frequencyQuery(c("Mücke", "Schnake"), paste0("pubDate in ", 2000:2003))
#' }
diff --git a/R/association-scores.R b/R/association-scores.R
index ddf3f5b..526ebab 100644
--- a/R/association-scores.R
+++ b/R/association-scores.R
@@ -24,7 +24,8 @@
#' @export
#'
#' @examples
-#' \donttest{
+#' \dontrun{
+#'
#' new("KorAPConnection", verbose = TRUE) %>%
#' collocationScoreQuery("Perlen", c("verziertes", "Säue"),
#' scoreFunctions = append(defaultAssociationScoreFunctions(),
diff --git a/R/ci.R b/R/ci.R
index 5de87a2..a0c04f7 100644
--- a/R/ci.R
+++ b/R/ci.R
@@ -22,7 +22,8 @@
#' @importFrom tibble remove_rownames
#' @importFrom dplyr enquo rename starts_with
#' @examples
-#' \donttest{
+#' \dontrun{
+#'
#' library(ggplot2)
#' kco <- new("KorAPConnection", verbose=TRUE)
#' expand_grid(year=2015:2018, alternatives=c("Hate Speech", "Hatespeech")) %>%
diff --git a/R/collocationAnalysis.R b/R/collocationAnalysis.R
index c14fdcb..bf962f6 100644
--- a/R/collocationAnalysis.R
+++ b/R/collocationAnalysis.R
@@ -44,7 +44,8 @@
#' @importFrom tidyr expand_grid
#'
#' @examples
-#' \donttest{
+#' \dontrun{
+#'
#' # Find top collocates of "Packung" inside and outside the sports domain.
#' new("KorAPConnection", verbose = TRUE) %>%
#' collocationAnalysis("Packung", vc=c("textClass=sport", "textClass!=sport"),
@@ -52,7 +53,8 @@
#' dplyr::filter(logDice >= 5)
#' }
#'
-#' \donttest{
+#' \dontrun{
+#'
#' # Identify the most prominent light verb construction with "in ... setzen".
#' # Note that, currently, the use of focus function disallows exactFrequencies.
#' new("KorAPConnection", verbose = TRUE) %>%
diff --git a/R/collocationScoreQuery.R b/R/collocationScoreQuery.R
index fe3893f..53d214a 100644
--- a/R/collocationScoreQuery.R
+++ b/R/collocationScoreQuery.R
@@ -31,18 +31,21 @@
#' @family collocation analysis functions
#'
#' @examples
-#' \donttest{
+#' \dontrun{
+#'
#' new("KorAPConnection", verbose = TRUE) %>%
#' collocationScoreQuery("Grund", "triftiger")
#' }
#'
-#' \donttest{
+#' \dontrun{
+#'
#' new("KorAPConnection", verbose = TRUE) %>%
#' collocationScoreQuery("Grund", c("guter", "triftiger"),
#' scoreFunctions = list(localMI = function(O1, O2, O, N, E, window_size) { O * log2(O/E) }) )
#' }
#'
-#' \donttest{
+#' \dontrun{
+#'
#' library(highcharter)
#' library(tidyr)
#' new("KorAPConnection", verbose = TRUE) %>%
diff --git a/R/hc_add_onclick_korap_search.R b/R/hc_add_onclick_korap_search.R
index 24ec37f..bf9d68b 100644
--- a/R/hc_add_onclick_korap_search.R
+++ b/R/hc_add_onclick_korap_search.R
@@ -14,7 +14,8 @@
#' @export
#'
#' @examples
-#' \donttest{
+#' \dontrun{
+#'
#' library(highcharter)
#' library(tidyr)
#'
diff --git a/R/hc_freq_by_year_ci.R b/R/hc_freq_by_year_ci.R
index dda6a63..08ae695 100644
--- a/R/hc_freq_by_year_ci.R
+++ b/R/hc_freq_by_year_ci.R
@@ -19,15 +19,18 @@
#' @param ... additional arguments passed to [hc_add_series()]
#'
#' @examples
-#' \donttest{year <- c(1990:2018)}\dontshow{year <- c(2013:2013)}
-#' \donttest{alternatives <- c("macht []{0,3} Sinn", "ergibt []{0,3} Sinn")}\dontshow{alternatives <- c("macht []{0,3} Sinn")}
+#' \dontrun{
+#'
+#' year <- c(1990:2018)}
+#' alternatives <- c("macht []{0,3} Sinn", "ergibt []{0,3} Sinn")}\dontshow{alternatives <- c("macht []{0,3} Sinn")}
#' new("KorAPConnection", verbose = TRUE) %>%
#' frequencyQuery(query = alternatives,
#' vc = paste("textType = /Zeit.*/ & pubDate in", year),
#' as.alternatives = TRUE) %>%
#' hc_freq_by_year_ci(as.alternatives = TRUE)
#'
-#' \donttest{
+#' \dontrun{
+#'
#' kco <- new("KorAPConnection", verbose = TRUE)
#' expand_grid(
#' condition = c("textDomain = /Wirtschaft.*/", "textDomain != /Wirtschaft.*/"),
diff --git a/R/misc.R b/R/misc.R
index 778b6df..bd5cdb6 100644
--- a/R/misc.R
+++ b/R/misc.R
@@ -21,7 +21,8 @@
#' @importFrom dplyr .data
#'
#' @examples
-#' \donttest{
+#' \dontrun{
+#'
#' new("KorAPConnection") %>% frequencyQuery("Test", paste0("pubDate in ", 2000:2002)) %>% ipm()
#' }
ipm <- function(df) {
@@ -43,7 +44,8 @@
#'
#' @rdname misc-functions
#' @examples
-#' \donttest{
+#' \dontrun{
+#'
#' new("KorAPConnection") %>%
#' frequencyQuery(c("Tollpatsch", "Tolpatsch"),
#' vc=paste0("pubDate in ", 2000:2002),
@@ -111,7 +113,8 @@
#' @examples
#' library(ggplot2)
#' kco <- new("KorAPConnection", verbose=TRUE)
-#' \donttest{
+#' \dontrun{
+#'
#' expand_grid(condition = c("textDomain = /Wirtschaft.*/", "textDomain != /Wirtschaft.*/"),
#' year = (2005:2011)) %>%
#' cbind(frequencyQuery(kco, "[tt/l=Heuschrecke]",