Explicitely use and import dplyr::n
Fixes issues with dplyr 1.0
Change-Id: I73c59b00ee8fcc525084767d7520d6dfc4afb311
diff --git a/NAMESPACE b/NAMESPACE
index 096d676..3596a04 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -13,6 +13,7 @@
export(hc_freq_by_year_ci)
export(ipm)
export(mutate)
+export(n)
export(percent)
export(queryStringToLabel)
export(select)
@@ -49,6 +50,7 @@
importFrom(dplyr,enquo)
importFrom(dplyr,group_by)
importFrom(dplyr,mutate)
+importFrom(dplyr,n)
importFrom(dplyr,rename)
importFrom(dplyr,rowwise)
importFrom(dplyr,select)
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index 596cd90..64ee8c6 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -113,7 +113,7 @@
#' mutate(year = lubridate::year(pubDate)) %>%
#' dplyr::select(year) %>%
#' group_by(year) %>%
-#' summarise(Count = n()) %>%
+#' summarise(Count = dplyr::n()) %>%
#' mutate(Freq = mapply(function(f, y)
#' f / corpusStats(kco, paste("pubDate in", y))@tokens, Count, year)) %>%
#' dplyr::select(-Count) %>%
@@ -231,7 +231,7 @@
#' @aliases fetchNext
#' @rdname KorAPQuery-class
#' @importFrom purrr map_dfr
-#' @importFrom dplyr rowwise bind_rows select
+#' @importFrom dplyr rowwise bind_rows select summarise n
#' @export
setMethod("fetchNext", "KorAPQuery", function(kqo, offset = kqo@nextStartIndex, maxFetch = maxResultsPerPage, verbose = kqo@korapConnection@verbose) {
if (kqo@totalResults == 0 || offset >= kqo@totalResults) {
diff --git a/R/reexports.R b/R/reexports.R
index 1a4d729..1630dd9 100644
--- a/R/reexports.R
+++ b/R/reexports.R
@@ -25,6 +25,9 @@
#' @importFrom dplyr summarise
#' @export
dplyr::summarise
+#' @importFrom dplyr n
+#' @export
+dplyr::n
#' @importFrom tidyr complete
#' @export
tidyr::complete
diff --git a/man/corpusQuery-KorAPConnection-method.Rd b/man/corpusQuery-KorAPConnection-method.Rd
index 98a2988..d3284a6 100644
--- a/man/corpusQuery-KorAPConnection-method.Rd
+++ b/man/corpusQuery-KorAPConnection-method.Rd
@@ -76,7 +76,7 @@
mutate(year = lubridate::year(pubDate)) \%>\%
dplyr::select(year) \%>\%
group_by(year) \%>\%
- summarise(Count = n()) \%>\%
+ summarise(Count = dplyr::n()) \%>\%
mutate(Freq = mapply(function(f, y)
f / corpusStats(kco, paste("pubDate in", y))@tokens, Count, year)) \%>\%
dplyr::select(-Count) \%>\%
diff --git a/man/reexports.Rd b/man/reexports.Rd
index 3bce579..919c52c 100644
--- a/man/reexports.Rd
+++ b/man/reexports.Rd
@@ -8,6 +8,7 @@
\alias{select}
\alias{group_by}
\alias{summarise}
+\alias{n}
\alias{complete}
\alias{expand_grid}
\alias{year}
@@ -22,7 +23,7 @@
\describe{
\item{broom}{\code{\link[broom]{tidy}}}
- \item{dplyr}{\code{\link[dplyr]{bind_cols}}, \code{\link[dplyr]{group_by}}, \code{\link[dplyr]{mutate}}, \code{\link[dplyr]{select}}, \code{\link[dplyr]{summarise}}}
+ \item{dplyr}{\code{\link[dplyr]{bind_cols}}, \code{\link[dplyr]{group_by}}, \code{\link[dplyr]{mutate}}, \code{\link[dplyr]{n}}, \code{\link[dplyr]{select}}, \code{\link[dplyr]{summarise}}}
\item{lubridate}{\code{\link[lubridate]{year}}}