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]",
diff --git a/man/KorAPConnection-class.Rd b/man/KorAPConnection-class.Rd
index 33fdb2b..ee18692 100644
--- a/man/KorAPConnection-class.Rd
+++ b/man/KorAPConnection-class.Rd
@@ -92,13 +92,15 @@
New \code{KorAPConnection} objects can be created by \code{new("KorAPConnection")}.
}
\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)
@@ -106,11 +108,13 @@
}
\dontrun{
+
kco <- new("KorAPConnection", accessToken="e739u6eOzkwADQPdVChxFg")
persistAccessToken(kco)
}
\dontrun{
+
kco <- new("KorAPConnection")
clearAccessToken(kco)
}
diff --git a/man/KorAPQuery-class.Rd b/man/KorAPQuery-class.Rd
index 13f0337..1f0bca3 100644
--- a/man/KorAPQuery-class.Rd
+++ b/man/KorAPQuery-class.Rd
@@ -177,20 +177,25 @@
virtual corpora.
}
\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") \%>\%
@@ -206,21 +211,26 @@
complete(year = min(year):max(year), fill = list(Freq = 0)) \%>\%
plot(type = "l")
}
-\donttest{q <- new("KorAPConnection") \%>\% corpusQuery("Ameisenplage") \%>\% fetchNext()
+\dontrun{
+
+q <- new("KorAPConnection") \%>\% corpusQuery("Ameisenplage") \%>\% fetchNext()
q@collectedMatches
}
-\donttest{
+\dontrun{
+
q <- new("KorAPConnection") \%>\% corpusQuery("Ameisenplage") \%>\% fetchAll()
q@collectedMatches
}
-\donttest{
+\dontrun{
+
q <- new("KorAPConnection") \%>\% corpusQuery("Ameisenplage") \%>\% fetchRest()
q@collectedMatches
}
-\donttest{
+\dontrun{
+
new("KorAPConnection", verbose = TRUE) \%>\%
frequencyQuery(c("Mücke", "Schnake"), paste0("pubDate in ", 2000:2003))
}
diff --git a/man/association-score-functions.Rd b/man/association-score-functions.Rd
index 3f6b4b7..914d96c 100644
--- a/man/association-score-functions.Rd
+++ b/man/association-score-functions.Rd
@@ -57,7 +57,8 @@
\strong{ll}: log-likelihood (Dunning 1993) using Stefan Evert's (2004) simplified implementation
}
\examples{
-\donttest{
+\dontrun{
+
new("KorAPConnection", verbose = TRUE) \%>\%
collocationScoreQuery("Perlen", c("verziertes", "Säue"),
scoreFunctions = append(defaultAssociationScoreFunctions(),
diff --git a/man/collocationAnalysis-KorAPConnection-method.Rd b/man/collocationAnalysis-KorAPConnection-method.Rd
index 840cd47..8ee0418 100644
--- a/man/collocationAnalysis-KorAPConnection-method.Rd
+++ b/man/collocationAnalysis-KorAPConnection-method.Rd
@@ -81,7 +81,8 @@
user interface.
}
\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"),
@@ -89,7 +90,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/man/collocationScoreQuery-KorAPConnection-method.Rd b/man/collocationScoreQuery-KorAPConnection-method.Rd
index 4aec265..bc236ee 100644
--- a/man/collocationScoreQuery-KorAPConnection-method.Rd
+++ b/man/collocationScoreQuery-KorAPConnection-method.Rd
@@ -56,18 +56,21 @@
based on \code{\link[=frequencyQuery]{frequencyQuery()}}s for a target word and a collocate.
}
\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/man/hc_add_onclick_korap_search.Rd b/man/hc_add_onclick_korap_search.Rd
index 805ff11..0c56f9a 100644
--- a/man/hc_add_onclick_korap_search.Rd
+++ b/man/hc_add_onclick_korap_search.Rd
@@ -18,7 +18,8 @@
a separate tab.
}
\examples{
-\donttest{
+\dontrun{
+
library(highcharter)
library(tidyr)
diff --git a/man/hc_freq_by_year_ci.Rd b/man/hc_freq_by_year_ci.Rd
index dae39e7..df2a1b7 100644
--- a/man/hc_freq_by_year_ci.Rd
+++ b/man/hc_freq_by_year_ci.Rd
@@ -30,30 +30,6 @@
\strong{Warning:} This function may be moved to a new package.
}
-\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")}
-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{
-kco <- new("KorAPConnection", verbose = TRUE)
-expand_grid(
- condition = c("textDomain = /Wirtschaft.*/", "textDomain != /Wirtschaft.*/"),
- year = (2005:2011)
-) \%>\%
- cbind(frequencyQuery(
- kco,
- "[tt/l=Heuschrecke]",
- paste0(.$condition, " & pubDate in ", .$year)
- )) \%>\%
- hc_freq_by_year_ci()
-}
-
-}
\seealso{
Other highcharter-helpers:
\code{\link{hc_add_onclick_korap_search}()}
diff --git a/man/misc-functions.Rd b/man/misc-functions.Rd
index aad5c80..f0ae3c2 100644
--- a/man/misc-functions.Rd
+++ b/man/misc-functions.Rd
@@ -71,7 +71,8 @@
und multiplies conf.low and \code{conf.high} with 10^6.
}
\examples{
-\donttest{
+\dontrun{
+
library(ggplot2)
kco <- new("KorAPConnection", verbose=TRUE)
expand_grid(year=2015:2018, alternatives=c("Hate Speech", "Hatespeech")) \%>\%
@@ -81,10 +82,12 @@
ggplot(aes(x=year, y=f, fill=query, color=query, ymin=conf.low, ymax=conf.high)) +
geom_point() + geom_line() + geom_ribbon(alpha=.3)
}
-\donttest{
+\dontrun{
+
new("KorAPConnection") \%>\% frequencyQuery("Test", paste0("pubDate in ", 2000:2002)) \%>\% ipm()
}
-\donttest{
+\dontrun{
+
new("KorAPConnection") \%>\%
frequencyQuery(c("Tollpatsch", "Tolpatsch"),
vc=paste0("pubDate in ", 2000:2002),
@@ -97,7 +100,8 @@
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]",