You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
977B

  1. source(here::here("R/00_base.R"))
  2. step2 <- initial_dfs %>%
  3. filter(.id == "x" | value %in% paste(1:2)) %>%
  4. mutate(
  5. frame = 2,
  6. .x = ifelse(.id == "y", 1, .x),
  7. .x = .x + 1
  8. )
  9. step3 <- step2 %>%
  10. filter(grepl("3", value)) %>%
  11. ungroup() %>%
  12. mutate(frame = 3, .y = -1)
  13. aj <- initial_dfs %>%
  14. mutate(removed = .id == "y", removed = as.integer(removed)) %>%
  15. bind_rows(step2, step3) %>%
  16. mutate(removed = ifelse(is.na(removed), 0, removed)) %>%
  17. arrange(removed, .y, .x, desc(frame)) %>% #View()
  18. mutate(alpha = case_when(
  19. grepl("3", value) ~ 1,
  20. frame == 2 & label == "id" ~ 0.25,
  21. frame == 2 ~ 0.65,
  22. TRUE ~ 1
  23. )) %>%
  24. {
  25. plot_data(., "anti_join(x, y)") +
  26. aes(alpha = alpha) +
  27. scale_alpha_identity()
  28. } %>%
  29. animate_plot()
  30. aj <- animate(aj)
  31. anim_save(here::here("images", "anti-join.gif"), aj)
  32. aj_g <- anti_join(x, y, by = "id") %>%
  33. proc_data() %>%
  34. plot_data("anti_join(x, y)")
  35. save_static_plot(aj_g, "anti-join")