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ů.

96 lines
2.2KB

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