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/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")
+
+
+}