Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

81 linhas
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. id = 1:3,
  33. x = paste0("x", 1:3)
  34. )
  35. y <- data_frame(
  36. id = (1:4)[-3],
  37. y = paste0("y", (1:4)[-3])
  38. )
  39. animate_union(x, y, by = "id", export = "first")
  40. animate_union(x, y, by = "id", export = "last")
  41. # Animate the first or last state of the join
  42. animate_union(x, y, export = "first")
  43. animate_union(x, y, export = "last")
  44. # animate the transition as a gif (default)
  45. \donttest{
  46. animate_union(x, y, export = "gif")
  47. }
  48. # different options include
  49. \donttest{
  50. animate_union(x, y, by = "id")
  51. animate_union_all(x, y, by = "id")
  52. animate_intersect(x, y, by = "id")
  53. animate_setdiff(x, y, by = "id")
  54. }
  55. # Save the results
  56. \dontrun{
  57. # to save the ggplot, use
  58. un <- animate_union(x, y, by = "id", export = "last")
  59. ggsave("union.pdf", un)
  60. animate_union(x, y, by = "id", export = "gif")
  61. # to save the gif, use
  62. un <- animate_union(x, y, by = "id", export = "gif")
  63. anim_save(un, "union.gif")
  64. }
  65. }
  66. \seealso{
  67. \code{\link[dplyr]{setops}}
  68. }