% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/animate_tidyr.R
\name{animate_spread}
\alias{animate_spread}
\title{Animates the spread function}
\usage{
animate_spread(l, key, value, export = "gif", detailed = TRUE, ...)
}
\arguments{
\item{l}{a data_frame in the long/tidy format}

\item{key}{the key}

\item{value}{the values}

\item{export}{the export type, either gif, first or last. The latter two
export ggplots of the first/last state of the spread function}

\item{detailed}{boolean value if the animation should show one step for each
key value}

\item{...}{further arguments passed to static_plot}
}
\value{
a ggplot or a gif
}
\description{
Animates the spread function
}
\examples{
long <- data_frame(
  year = c(2010L, 2011L, 2010L, 2011L, 2010L, 2011L),
  person = c("Alice", "Alice", "Bob", "Bob", "Charlie", "Charlie"),
  sales = c(105, 110, 100, 97, 90, 95)
)
animate_spread(long, key = "person", value = "sales", export = "first")
animate_spread(long, key = "person", value = "sales", export = "last")

\donttest{
  animate_spread(long, key = "person", value = "sales", export = "gif")
  # if you want to have a less detailed animation, you can also use
  animate_spread(long, key = "person", value = "sales", export = "gif", detailed = FALSE)
}
}
