Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

94 lines
2.4KB

  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_join(x, y, by, type = c("full_join", "inner_join", "left_join",
  14. "right_join", "semi_join", "anti_join"), export = c("gif", "first",
  15. "last"), ...)
  16. animate_full_join(x, y, by, export = "gif", ...)
  17. animate_inner_join(x, y, by, export = "gif", ...)
  18. animate_left_join(x, y, by, export = "gif", ...)
  19. animate_right_join(x, y, by, export = "gif", ...)
  20. animate_semi_join(x, y, by, export = "gif", ...)
  21. animate_anti_join(x, y, by, export = "gif", ...)
  22. }
  23. \arguments{
  24. \item{x}{the x dataset}
  25. \item{y}{the y dataset}
  26. \item{by}{the by arguments for the join}
  27. \item{export}{the export type, either gif, first or last. The latter two
  28. export ggplots of the first/last state of the join}
  29. \item{...}{further arguments passed to anim_options()}
  30. }
  31. \value{
  32. either a gif or a ggplot
  33. }
  34. \description{
  35. Functions to visualise the join operations either static as a ggplot, or
  36. dynamic as a gif.
  37. }
  38. \examples{
  39. x <- data_frame(id = 1:3, x = paste0("x", 1:3))
  40. y <- data_frame(id = (1:4)[-3], y = paste0("y", (1:4)[-3]))
  41. # Animate the first or last state of the join
  42. animate_full_join(x, y, by = "id", export = "first")
  43. animate_full_join(x, y, by = "id", export = "last")
  44. # animate the transition as a gif (default)
  45. \donttest{
  46. animate_full_join(x, y, by = "id", export = "gif")
  47. }
  48. # different options include
  49. \donttest{
  50. animate_full_join(x, y, by = "id")
  51. animate_inner_join(x, y, by = "id")
  52. animate_left_join(x, y, by = "id")
  53. animate_right_join(x, y, by = "id")
  54. animate_semi_join(x, y, by = "id")
  55. animate_anti_join(x, y, by = "id")
  56. # further arguments can be passed to all animate_* functions, see also ?anim_options
  57. animate_full_join(
  58. x, y, by = "id", export = "last",
  59. text_size = 5, title_size = 25,
  60. color_header = "black",
  61. color_other = "lightblue",
  62. color_fun = viridis::viridis
  63. )
  64. }
  65. # Save the results
  66. \donttest{
  67. # to save the ggplot, use
  68. fj <- animate_full_join(x, y, by = "id", export = "last")
  69. ggsave("full-join.pdf", fj)
  70. # to save the gif, use
  71. fj <- animate_full_join(x, y, by = "id", export = "gif")
  72. anim_save(fj, "full-join.gif")
  73. }
  74. }
  75. \seealso{
  76. \code{\link[dplyr]{join}}
  77. }