Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

87 lines
1.8KB

  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/animate_sets.R
  3. \name{animate_set}
  4. \alias{animate_set}
  5. \alias{animate_union}
  6. \alias{animate_union_all}
  7. \alias{animate_intersect}
  8. \alias{animate_setdiff}
  9. \title{Animates a set operation}
  10. \usage{
  11. animate_union(x, y, export = "gif", ...)
  12. animate_union_all(x, y, export = "gif", ...)
  13. animate_intersect(x, y, export = "gif", ...)
  14. animate_setdiff(x, y, export = "gif", ...)
  15. }
  16. \arguments{
  17. \item{x}{the x dataset}
  18. \item{y}{the y dataset}
  19. \item{export}{the export type, either gif, first or last. The latter two
  20. export ggplots of the first/last state of the join}
  21. \item{...}{further argument passed to base_plot}
  22. }
  23. \value{
  24. either a gif or a ggplot
  25. }
  26. \description{
  27. Functions to visualise the set operations either static as a ggplot, or
  28. dynamic as a gif.
  29. }
  30. \examples{
  31. x <- data_frame(
  32. x = c(1, 1, 2),
  33. y = c("a", "b", "a")
  34. )
  35. y <- data_frame(
  36. x = c(1, 2),
  37. y = c("a", "b")
  38. )
  39. # Animate the first or last state of the set
  40. animate_union(x, y, export = "first")
  41. animate_union(x, y, export = "last")
  42. # animate the transition as a gif (default)
  43. \donttest{
  44. animate_union(x, y, export = "gif")
  45. }
  46. # different options include
  47. \donttest{
  48. animate_union(x, y)
  49. animate_union_all(x, y)
  50. animate_intersect(x, y)
  51. animate_setdiff(x, y)
  52. # further arguments can be passed to all animate_* functions
  53. animate_union(
  54. x, y,
  55. text_size = 5, title_size = 25,
  56. color_header = "black",
  57. color_other = "lightblue",
  58. color_fun = viridis::viridis
  59. )
  60. }
  61. # Save the results
  62. \dontrun{
  63. # to save the ggplot, use
  64. un <- animate_union(x, y, by = "id", export = "last")
  65. ggsave("union.pdf", un)
  66. animate_union(x, y, by = "id", export = "gif")
  67. # to save the gif, use
  68. un <- animate_union(x, y, by = "id", export = "gif")
  69. anim_save(un, "union.gif")
  70. }
  71. }
  72. \seealso{
  73. \code{\link[dplyr]{setops}}
  74. }