Start tidyverse migration
Change-Id: Ifc972de789c22e2ff43159740d7f1fa7125e1ef2
diff --git a/man/KorAPQuery-class.Rd b/man/KorAPQuery-class.Rd
index 1bc7bd4..b5c9a8a 100644
--- a/man/KorAPQuery-class.Rd
+++ b/man/KorAPQuery-class.Rd
@@ -82,10 +82,10 @@
New \code{KorAPQuery} objects are typically created by the \code{\link{corpusQuery}} method.
}
\examples{
-q <- fetchAll(corpusQuery(new("KorAPConnection"), "Ameisenplage"))
+q <- new("KorAPConnection") \%>\% corpusQuery("Ameisenplage") \%>\% fetchAll()
q@collectedMatches
-q <- fetchRest(fetchNext(corpusQuery(new("KorAPConnection"), "Ameisenplage")))
+q <- new("KorAPConnection") \%>\% corpusQuery("Ameisenplage") \%>\% fetchAll()
q@collectedMatches
}
diff --git a/man/corpusQuery-KorAPConnection-method.Rd b/man/corpusQuery-KorAPConnection-method.Rd
index 86d98e5..e623297 100644
--- a/man/corpusQuery-KorAPConnection-method.Rd
+++ b/man/corpusQuery-KorAPConnection-method.Rd
@@ -39,28 +39,30 @@
}
\examples{
# Fetch metadata of every query hit for "Ameisenplage" and show a summary
-kco <- new("KorAPConnection")
-kqo <- corpusQuery(kco, "Ameisenplage")
-kqo <- fetchAll(kqo)
-kqo
+new("KorAPConnection") \%>\% corpusQuery("Ameisenplage") \%>\% fetchAll()
# 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).
-kco <- new("KorAPConnection")
-kqo <- corpusQuery(kco,
- KorAPUrl = "https://korap.ids-mannheim.de/?q=Ameise&cq=pubDate+since+2017&ql=poliqarp")
-kqo
+
+new("KorAPConnection", verbose = TRUE) \%>\%
+ corpusQuery(KorAPUrl =
+ "https://korap.ids-mannheim.de/?q=Ameise&cq=pubDate+since+2017&ql=poliqarp")
# Plot the time/frequency curve of "Ameisenplage"
-kco <- new("KorAPConnection", verbose=TRUE)
-q <- fetchAll(corpusQuery(kco, "Ameisenplage"))
-df <- as.data.frame(table(as.numeric(format(q@collectedMatches$pubDate,"\%Y")), dnn="year"),
- stringsAsFactors = FALSE)
-df$Freq <- mapply(function(f, y) f / corpusStats(kco, paste("pubDate in", y))@tokens,
- df$Freq, df$year)
-df <- merge(data.frame(year=min(df$year):max(df$year)), df, all = TRUE)
-df[is.na(df$Freq),]$Freq <- 0
-plot(df, type="l")
+new("KorAPConnection", verbose=TRUE) \%>\%
+ { . ->> kco } \%>\%
+ corpusQuery("Ameisenplage") \%>\%
+ fetchAll() \%>\%
+ slot("collectedMatches") \%>\%
+ mutate(year = lubridate::year(pubDate)) \%>\%
+ dplyr::select(year) \%>\%
+ group_by(year) \%>\%
+ summarise(Count = n()) \%>\%
+ mutate(Freq = mapply(function(f, y)
+ f / corpusStats(kco, paste("pubDate in", y))@tokens, Count, year)) \%>\%
+ dplyr::select(-Count) \%>\%
+ complete(year = min(year):max(year), fill = list(Freq = 0)) \%>\%
+ plot(type = "l")
}
\references{
diff --git a/man/pipe.Rd b/man/pipe.Rd
new file mode 100644
index 0000000..32004dc
--- /dev/null
+++ b/man/pipe.Rd
@@ -0,0 +1,12 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/reexports.R
+\name{\%>\%}
+\alias{\%>\%}
+\title{Pipe operator}
+\usage{
+lhs \%>\% rhs
+}
+\description{
+See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details.
+}
+\keyword{internal}
diff --git a/man/reexports.Rd b/man/reexports.Rd
new file mode 100644
index 0000000..81287d2
--- /dev/null
+++ b/man/reexports.Rd
@@ -0,0 +1,25 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/reexports.R
+\docType{import}
+\name{reexports}
+\alias{reexports}
+\alias{mutate}
+\alias{select}
+\alias{group_by}
+\alias{summarise}
+\alias{complete}
+\alias{year}
+\title{Objects exported from other packages}
+\keyword{internal}
+\description{
+These objects are imported from other packages. Follow the links
+below to see their documentation.
+
+\describe{
+ \item{dplyr}{\code{\link[dplyr]{mutate}}, \code{\link[dplyr]{select}}, \code{\link[dplyr]{group_by}}, \code{\link[dplyr]{summarise}}}
+
+ \item{lubridate}{\code{\link[lubridate]{year}}}
+
+ \item{tidyr}{\code{\link[tidyr]{complete}}}
+}}
+