Simplify tibble creation in fetchNext
Fixes type collisions with dplyr 1.0.
Change-Id: I89e88437ace022298797f1b81ff99b64bc4fefc5
diff --git a/NAMESPACE b/NAMESPACE
index 06e32cd..e7cce27 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -73,7 +73,6 @@
importFrom(lubridate,year)
importFrom(magrittr,"%>%")
importFrom(plotly,ggplotly)
-importFrom(purrr,map_dfr)
importFrom(stats,prop.test)
importFrom(tibble,add_column)
importFrom(tibble,as_tibble)
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index 64ee8c6..3ce4773 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -230,7 +230,6 @@
#'
#' @aliases fetchNext
#' @rdname KorAPQuery-class
-#' @importFrom purrr map_dfr
#' @importFrom dplyr rowwise bind_rows select summarise n
#' @export
setMethod("fetchNext", "KorAPQuery", function(kqo, offset = kqo@nextStartIndex, maxFetch = maxResultsPerPage, verbose = kqo@korapConnection@verbose) {
@@ -252,9 +251,7 @@
}
}
currentMatches <-
- kqo@fields %>%
- map_dfr( ~tibble(!!.x := logical() ) ) %>%
- bind_rows(res$matches) %>%
+ res$matches %>%
dplyr::select(kqo@fields)
if ("pubDate" %in% kqo@fields) {
currentMatches$pubDate <- currentMatches$pubDate %>% as.Date(format = "%Y-%m-%d")