Garrick Aden-Buie Profile picture
full-stack R developer. shiny app dev. tidyverse instructor. always learning something new. dreams in #rstats. writes in #rmarkdown. paints in #ggplot. he/him

Aug 15, 2018, 8 tweets

Getting ready to teach dplyr joins to new #rstats users tomorrow, so naturally I productively procrastinated by getting to know the new gganimate. It is the coolest!

The readme is a great intro -- github.com/thomasp85/ggan…. I basically just replaced `+facet_wrap(~ key)` with `+transition_states(key)`.

I really like how easily the gganimate calls fit in with the ggplot pipeline. It's very clear @thomasp85 put a lot of thought and care into the API design.

inner_join() was the trickiest because the order of the rows matters when gganimate moves objects around. full_join() was a lot easier because all the elements stay visible.

Those are the mutating joins, here's a filtering join: semi_join(). If you want to learn more about dplyr joins, the #R4DS chapter on relational data is a great resource. r4ds.had.co.nz/relation-data.…

And finally, our last join of the evening: the anti_join().

The source is available here: gist.github.com/gadenbuie/077b…

Feel free to use the source or the images for any #rstats teaching!

Encore animated join -- what if `y` has duplicate rows with the key in `x`? left_join gives all combinations of matches, so there are more rows in the result than in `x`. Thanks to @zeehio_ for pointing this out!

Thanks everyone for your comments and for sharing! The animations were super helpful in class today -- hopefully they can help you too!

I just moved the source and downloadable gifs to github.com/gadenbuie/tidy…

Stay tuned for {tidyr} animations next week! 😎

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling