Fix no-visible-binding-for-global-variable-note-in-r-cmd-check

Change-Id: Icb4ecdb2a3d02bbae8bef7c21d03b88a7107a4d2
diff --git a/NAMESPACE b/NAMESPACE
index 534fbd3..e7aa324 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -86,6 +86,7 @@
 importFrom(dplyr,summarise)
 importFrom(dplyr,tibble)
 importFrom(dplyr,ungroup)
+importFrom(dplyr,where)
 importFrom(ggplot2,GeomPoint)
 importFrom(ggplot2,aes)
 importFrom(ggplot2,element_text)
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index 432dea4..a9882cb 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -286,13 +286,14 @@
                                               maxFetch = maxResultsPerPage,
                                               verbose = kqo@korapConnection@verbose,
                                               randomizePageOrder = FALSE) {
+  # https://stackoverflow.com/questions/8096313/no-visible-binding-for-global-variable-note-in-r-cmd-check
+  results <- key <- name <- pubDate <- tmp_positions <- 0
+
   if (kqo@totalResults == 0 || offset >= kqo@totalResults) {
     return(kqo)
   }
   use_korap_api <- Sys.getenv("USE_KORAP_API", unset = NA)
   page <- kqo@nextStartIndex / maxResultsPerPage + 1
-  results <- 0
-  pubDate <- NULL # https://stackoverflow.com/questions/8096313/no-visible-binding-for-global-variable-note-in-r-cmd-check
   collectedMatches <- kqo@collectedMatches
 
   if (randomizePageOrder) {
diff --git a/R/collocationScoreQuery.R b/R/collocationScoreQuery.R
index 63aa002..cf05540 100644
--- a/R/collocationScoreQuery.R
+++ b/R/collocationScoreQuery.R
@@ -191,6 +191,9 @@
 #' @importFrom httr parse_url build_url
 #' @export
 mergeDuplicateCollocates <- function(...) {
+  # https://stackoverflow.com/questions/8096313/no-visible-binding-for-global-variable-note-in-r-cmd-check
+  O1 <- O2 <- O <- N <- E <- w <- leftContextSize <- rightContextSize <- collocate <- tmp_positions <- 0
+
   combined_df <- bind_rows(...)
 
   korapUrl <- parse_url(combined_df$webUIRequestUrl[1])
diff --git a/R/textMetadata.R b/R/textMetadata.R
index b23bc49..2e5372f 100644
--- a/R/textMetadata.R
+++ b/R/textMetadata.R
@@ -17,7 +17,7 @@
 #' If there are metadata columns you cannot make sense of, please ignore them. The function simply returns all the metadata it gets from the server.
 #'
 #' @importFrom urltools url_encode
-#' @importFrom dplyr bind_rows relocate mutate
+#' @importFrom dplyr across bind_rows relocate mutate where
 #' @importFrom tibble as_tibble
 #' @importFrom tidyr pivot_wider
 #'
@@ -29,6 +29,8 @@
 #' @export
 setMethod("textMetadata", "KorAPConnection",
  function(kco, textSigle, verbose = kco@verbose) {
+  # https://stackoverflow.com/questions/8096313/no-visible-binding-for-global-variable-note-in-r-cmd-check
+  key <- 0
   if (length(textSigle) > 1)
     do.call(bind_rows, Map(function(atomicSigle)
       textMetadata(kco, atomicSigle), textSigle))