andrew,
@andrew@fediscience.org avatar

After years of wishing something like this existed, I decided to finally buckle down and make it myself. Behold, an animated explanation of what group_by() |> summarize() does in {dplyr} in !

More coming later with group_by(cat2), plus group_by(cat1, cat2) and ungroup()!

https://youtu.be/MJDJ8YDmHdQ

hadleywickham,
@hadleywickham@fosstodon.org avatar

@andrew this is awesome!

andrew,
@andrew@fediscience.org avatar

@hadleywickham Thanks!!

minecr,
@minecr@fosstodon.org avatar

@andrew These are great! One thing students find confusing in my experience is that group_by() doesn't actually arrange anything. So I think something like this might be good too? So the rows don't move around in the group_by() step.

andrew,
@andrew@fediscience.org avatar

@minecr Ooh this was a good suggestion! I ended up making one that just shows group_by and ungroup to show that the order stays how it is in the original data https://www.andrewheiss.com/blog/2024/04/04/group_by-summarize-ungroup-animations/#grouping-and-ungrouping-with-group_by-and-ungroup

grrrck,
@grrrck@fosstodon.org avatar

@andrew omg I love this!!

andrew,
@andrew@fediscience.org avatar

@grrrck I forked tidyexplain and was going to try doing this with gganimate, but it was too hard since there are so many different steps and it's not just toggling between two dataframes

But I copied the fonts/colors/animation timing so it fits with your other ones so maybe it could address this someday https://github.com/gadenbuie/tidyexplain/issues/31

grrrck,
@grrrck@fosstodon.org avatar

@andrew you had me at flying colored boxes! What did you end up using to make the animation?

I’ve looked at the issue many times trying to convince myself it would be easy. No pressure but if you want to add it to the collection I’m sure it would be appreciated and used!

andrew,
@andrew@fediscience.org avatar

@grrrck I'm doing it all by hand in Illustrator and After Effects

I'll add a PR with YouTube and/or Vimeo links + animated gifs + raw mp4s + whatever format you need once I finish the group_by(cat1, cat2) %>% summarize() %>% ungroup() animation

andrew,
@andrew@fediscience.org avatar

And here's an example of grouping by cat2 instead! #rstats https://www.youtube.com/watch?v=fHc2kuB6aVE

andrew,
@andrew@fediscience.org avatar

And the mega one! group_by() with multiple groups, summarize(), and ungroup()! https://youtu.be/JUvh1AzVsxI
#rstats

EvaMaeRey,

@andrew This is impressive! I wonder if cat2 cats could be y and z, avoiding 'x'?

andrew,
@andrew@fediscience.org avatar

@EvaMaeRey Ah good call! I just switched them to j and k

EvaMaeRey,

@andrew I like that the categories j and k are mixed up in the data. The group_by seems a little more dramatic - and instructive!

andrew,
@andrew@fediscience.org avatar

@EvaMaeRey Yeah, this is part 2, with group_by(cat2). I’m also making one with both cat1 and cat2

andrew,
@andrew@fediscience.org avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • Durango
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • khanakhh
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • everett
  • ngwrru68w68
  • kavyap
  • InstantRegret
  • JUstTest
  • cubers
  • GTA5RPClips
  • cisconetworking
  • ethstaker
  • osvaldo12
  • modclub
  • normalnudes
  • anitta
  • tester
  • megavids
  • Leos
  • provamag3
  • lostlight
  • All magazines