|
- % Generated by roxygen2: do not edit by hand
- % Please edit documentation in R/animate_sets.R
- \name{animate_set}
- \alias{animate_set}
- \alias{animate_union}
- \alias{animate_union_all}
- \alias{animate_intersect}
- \alias{animate_setdiff}
- \title{Animates a set operation}
- \usage{
- animate_set(x, y, type = c("union", "union_all", "intersect", "setdiff"),
- export = c("gif", "first", "last"), ...)
-
- animate_union(x, y, export = "gif", ...)
-
- animate_union_all(x, y, export = "gif", ...)
-
- animate_intersect(x, y, export = "gif", ...)
-
- animate_setdiff(x, y, export = "gif", ...)
- }
- \arguments{
- \item{x}{the x dataset}
-
- \item{y}{the y dataset}
-
- \item{type}{type of the set, i.e., intersect, setdiff, etc.}
-
- \item{export}{the export type, either gif, first or last. The latter two
- export ggplots of the first/last state of the join}
-
- \item{...}{further argument passed to anim_options()}
- }
- \value{
- either a gif or a ggplot
- }
- \description{
- Functions to visualise the set operations either static as a ggplot, or
- dynamic as a gif.
- }
- \examples{
- x <- data_frame(x = c(1, 1, 2), y = c("a", "b", "a"))
- y <- data_frame(x = c(1, 2), y = c("a", "b"))
-
- # Animate the first or last state of the set
- animate_union(x, y, export = "first")
- animate_union(x, y, export = "last")
-
- # animate the transition as a gif (default)
- \donttest{
- animate_union(x, y, export = "gif")
- }
-
- # different options include
- \donttest{
- animate_union(x, y)
- animate_union_all(x, y)
- animate_intersect(x, y)
- animate_setdiff(x, y)
-
- # further arguments can be passed to all animate_* functions
- animate_union(
- x, y,
- text_size = 5, title_size = 25,
- color_header = "black",
- color_fun = viridis::viridis
- )
- }
-
- # Save the results
- \dontrun{
- # to save the ggplot, use
- un <- animate_union(x, y, by = "id", export = "last")
- ggsave("union.pdf", un)
-
- animate_union(x, y, by = "id", export = "gif")
- # to save the gif, use
- un <- animate_union(x, y, by = "id", export = "gif")
- anim_save(un, "union.gif")
- }
- }
- \seealso{
- \code{\link[dplyr]{setops}}
- }
|