選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

85 行
1.9KB

  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_set(x, y, type = c("union", "union_all", "intersect", "setdiff"),
  12. export = c("gif", "first", "last"), ...)
  13. animate_union(x, y, export = "gif", ...)
  14. animate_union_all(x, y, export = "gif", ...)
  15. animate_intersect(x, y, export = "gif", ...)
  16. animate_setdiff(x, y, export = "gif", ...)
  17. }
  18. \arguments{
  19. \item{x}{the x dataset}
  20. \item{y}{the y dataset}
  21. \item{type}{type of the set, i.e., intersect, setdiff, etc.}
  22. \item{export}{the export type, either gif, first or last. The latter two
  23. export ggplots of the first/last state of the join}
  24. \item{...}{further argument passed to anim_options()}
  25. }
  26. \value{
  27. either a gif or a ggplot
  28. }
  29. \description{
  30. Functions to visualise the set operations either static as a ggplot, or
  31. dynamic as a gif.
  32. }
  33. \examples{
  34. x <- data_frame(x = c(1, 1, 2), y = c("a", "b", "a"))
  35. y <- data_frame(x = c(1, 2), y = c("a", "b"))
  36. # Animate the first or last state of the set
  37. animate_union(x, y, export = "first")
  38. animate_union(x, y, export = "last")
  39. # animate the transition as a gif (default)
  40. \donttest{
  41. animate_union(x, y, export = "gif")
  42. }
  43. # different options include
  44. \donttest{
  45. animate_union(x, y)
  46. animate_union_all(x, y)
  47. animate_intersect(x, y)
  48. animate_setdiff(x, y)
  49. # further arguments can be passed to all animate_* functions
  50. animate_union(
  51. x, y,
  52. text_size = 5, title_size = 25,
  53. color_header = "black",
  54. color_fun = viridis::viridis
  55. )
  56. }
  57. # Save the results
  58. \dontrun{
  59. # to save the ggplot, use
  60. un <- animate_union(x, y, by = "id", export = "last")
  61. ggsave("union.pdf", un)
  62. animate_union(x, y, by = "id", export = "gif")
  63. # to save the gif, use
  64. un <- animate_union(x, y, by = "id", export = "gif")
  65. anim_save(un, "union.gif")
  66. }
  67. }
  68. \seealso{
  69. \code{\link[dplyr]{setops}}
  70. }