% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/animate_joins.R
\name{animate_join}
\alias{animate_join}
\alias{animate_full_join}
\alias{animate_inner_join}
\alias{animate_left_join}
\alias{animate_right_join}
\alias{animate_semi_join}
\alias{animate_anti_join}
\title{Animates a join operations}
\usage{
animate_full_join(x, y, by, export = "gif", ...)

animate_inner_join(x, y, by, export = "gif", ...)

animate_left_join(x, y, by, export = "gif", ...)

animate_right_join(x, y, by, export = "gif", ...)

animate_semi_join(x, y, by, export = "gif", ...)

animate_anti_join(x, y, by, export = "gif", ...)
}
\arguments{
\item{x}{the x dataset}

\item{y}{the y dataset}

\item{by}{the by arguments for the join}

\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 arguments passed to static_plot}
}
\value{
either a gif or a ggplot
}
\description{
Functions to visualise the join operations either static as a ggplot, or
dynamic as a gif.
}
\examples{
x <- data_frame(
  id = 1:3,
  x = paste0("x", 1:3)
)
y <- data_frame(
  id = (1:4)[-3],
  y = paste0("y", (1:4)[-3])
)

# Animate the first or last state of the join
animate_full_join(x, y, by = "id", export = "first")
animate_full_join(x, y, by = "id", export = "last")

# animate the transition as a gif (default)
\donttest{
  animate_full_join(x, y, by = "id", export = "gif")
}

# different options include
\donttest{
  animate_full_join(x, y, by = "id")
  animate_inner_join(x, y, by = "id")
  animate_left_join(x, y, by = "id")
  animate_right_join(x, y, by = "id")
  animate_semi_join(x, y, by = "id")
  animate_anti_join(x, y, by = "id")

  # further arguments can be passed to all animate_* functions
  animate_full_join(
    x, y, by = "id", export = "last",
    text_size = 5, title_size = 25,
    color_header = "black",
    color_other = "lightblue",
    color_fun = viridis::viridis
  )
}

# Save the results
\donttest{
  # to save the ggplot, use
  fj <- animate_full_join(x, y, by = "id", export = "last")
  ggsave("full-join.pdf", fj)

  # to save the gif, use
  fj <- animate_full_join(x, y, by = "id", export = "gif")
  anim_save(fj, "full-join.gif")
}
}
\seealso{
\code{\link[dplyr]{join}}
}
