Add convenience bindings for ggplot2 and plotly with hyperlinks

These functions will probably be moved to a separate package.

Change-Id: Iaecd23b1401bc5df7ee4a904dca2e87466266143
diff --git a/man/geom_freq_by_year_ci.Rd b/man/geom_freq_by_year_ci.Rd
index ffdbdb3..74f8d40 100644
--- a/man/geom_freq_by_year_ci.Rd
+++ b/man/geom_freq_by_year_ci.Rd
@@ -2,12 +2,19 @@
 % Please edit documentation in R/misc.R
 \name{geom_freq_by_year_ci}
 \alias{geom_freq_by_year_ci}
-\title{Plot frequency by year graphs with confidence intervals}
+\title{Experimental: Plot frequency by year graphs with confidence intervals}
 \usage{
-geom_freq_by_year_ci()
+geom_freq_by_year_ci(mapping = aes(ymin = conf.low, ymax = conf.high),
+  ...)
+}
+\arguments{
+\item{mapping}{Set of aesthetic mappings created by aes() or aes_(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.}
+
+\item{...}{Other arguments passed to geom_ribbon, geom_line, and geom_click_point.}
 }
 \description{
-Convenience function for plotting typical frequency by year graphs with confidence intervals using ggplot2.
+Experimental convenience function for plotting typical frequency by year graphs with confidence intervals using ggplot2.
+\bold{Warning:} This function may be moved to a new package.
 }
 \examples{
 library(ggplot2)
@@ -17,7 +24,7 @@
   cbind(frequencyQuery(kco, "[tt/l=Heuschrecke]",
                             paste0(.$condition," & pubDate in ", .$year)))  \%>\%
   ipm() \%>\%
-  ggplot(aes(year, ipm, fill = condition, color = condition, ymin = conf.low, ymax = conf.high)) +
+  ggplot(aes(year, ipm, fill = condition, color = condition)) +
   geom_freq_by_year_ci()
 
 }
diff --git a/man/ggplotly.Rd b/man/ggplotly.Rd
new file mode 100644
index 0000000..7aedff6
--- /dev/null
+++ b/man/ggplotly.Rd
@@ -0,0 +1,40 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/misc.R
+\name{ggplotly}
+\alias{ggplotly}
+\title{Experimental: Convert ggplot2 to plotly with hyperlinks to KorAP queries}
+\usage{
+ggplotly(p = ggplot2::last_plot(), tooltip = c("x", "y", "colour",
+  "url"), ...)
+}
+\arguments{
+\item{p}{a ggplot object.}
+
+\item{tooltip}{a character vector specifying which aesthetic mappings to show
+in the tooltip. If you want hyperlinks to KorAP queries you need to include
+\code{"url"} here.}
+
+\item{...}{Other arguments passed to \code{plotly::ggplotly}}
+}
+\description{
+\code{RKorAPClient::ggplotly} converts a \code{ggplot2::ggplot()} object to a plotly
+object with hyperlinks from data points to corresponding KorAP queries.
+\bold{Warning:} This function may be moved to a new package.
+}
+\examples{
+library(ggplot2)
+kco <- new("KorAPConnection", verbose=TRUE)
+g <- expand_grid(condition = c("textDomain = /Wirtschaft.*/", "textDomain != /Wirtschaft.*/"),
+            year = (2002:2018)) \%>\%
+  cbind(frequencyQuery(kco, "[tt/l=Heuschrecke]",
+                       paste0(.$condition," & pubDate in ", .$year)))  \%>\%
+  ipm() \%>\%
+  ggplot(aes(year, ipm, fill = condition, color = condition)) +
+##  theme_light(base_size = 20) +
+  geom_freq_by_year_ci()
+p <- ggplotly(g)
+print(p)
+## saveWidget(p, paste0(tmpdir(), "heuschrecke.html")
+
+
+}