Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use package 'collector' #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Use package 'collector' #4

wants to merge 1 commit into from

Conversation

moodymudskipper
Copy link
Collaborator

@moodymudskipper moodymudskipper commented Apr 13, 2024

cc @krlmlr

This PR is a single line, to advertise the latest version described here: cynkra/collector#1

library(dplyr, w = F)

starwars %>%
  select(name, mass) %>%
  mutate(
    mass2 = mass * 2,
    mass2_squared = mass2 * mass2
  )

mtcars %>%
  group_by(cyl) %>%
  summarise(disp = mean(disp), sd = sd(disp))

.rs.restartR()

reloaded <- qs::qread("collector/1-select.qs")
with(reloaded, eval(call, env))

reloaded <- qs::qread("collector/2-mutate.qs")
with(reloaded, eval(call, env))

reloaded <- qs::qread("collector/3-group_by.qs")
with(reloaded, eval(call, env))

reloaded <- qs::qread("collector/4-summarise.qs")
with(reloaded, eval(call, env))

It's cool to see that we need 41kB for the select call (big data frame) but only 6.2 kB for the mutate call (only 2 cols for the df)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant