Create an animation to show datasets that share sample summary statistics with Anscombe's quartet.

anscombise_gif(
  x,
  which = 1,
  idempotent = TRUE,
  theme_name = "classic",
  ease = "cubic-in-out",
  transition_length = 3,
  state_length = 1,
  wrap = TRUE
)

Arguments

x

A list of input datasets. Each one must be a suitable argument x for anscombise.

which, idempotent

Vectors that provide the arguments of the same names to anscombise for each dataset. If necessary, rep_len is used to replicate these arguments so that they each have length length(x).

theme_name

A character scalar used to set the ggtheme. One of "grey", "gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void" or "test".

ease

A character scalar passed to ease_aes to control how the points move in transitioning from one dataset to the next.

transition_length, state_length, wrap

Arguments passed to transition_states.

Value

An object of class c("gganim", "gg", "ggplot") with an additional attribute new_data that is a data frame with 3 variables, x, y and dataset containing the datasets output from anscombise.

The returned object may be displayed using by typing its name, e.g., anim or saved as a GIF file using anim_save, e.g., gganimate::anim_save("anscombe.gif", anim).

Details

For this function to work the packages ggplot2 and gganimate must be installed.

See also

anscombise modifies a dataset so that it shares sample summary statistics with Anscombe's quartet.

input_datasets: input1 to input8 for some input datasets of the same size as those in Anscombe's quartet.

Examples

# Animate some Anscombe-like datasets produced using input1 to input8
x <- list(input1, input2, input3, input4, input5, input6, input7, input8)
idem <- c(FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE)
anim <- anscombise_gif(x, idempotent = idem)