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

detect what which df cols or list elts are needed #14

Open
moodymudskipper opened this issue Apr 24, 2024 · 1 comment
Open

detect what which df cols or list elts are needed #14

moodymudskipper opened this issue Apr 24, 2024 · 1 comment

Comments

@moodymudskipper
Copy link
Collaborator

moodymudskipper commented Apr 24, 2024

A crazy idea probably but...

The trick that wu use for environments using lazy bindings, could be use on data frames and lists if they were built on top of environments.

environments are generalised lists basically, they just miss bracket methods, length, and names are not an attributes (actually a "names" attribute cannot be set) .

If we hack the base namespace (and possibly rlang) we can patch those primitives to handle classed environment with classes data.frame or list (we could define super classes e_frame and e_list but it would be less robust), we could then replace data.frames and lists by classed environments, and use the lazy binding trick to find what columns or list elements are not required. The changes by reference are irrelevant here because we don't modify those objects.

Not trivial and can go wrong in many ways but this might also work in most cases, because most of these functions just call bracket methods and length down the line.

subsetting data.frames with i evaluates everything however, unless we use further magic make it lazy and apply it only after j subsetting occurs but it's really complicated at that point

@krlmlr
Copy link
Contributor

krlmlr commented Apr 24, 2024

This is what mutate() uses internally.

Let's do #15 first, understanding this will reduce the data size by a lot.

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

No branches or pull requests

2 participants