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

Support nesting() #250

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft

Conversation

mgirlich
Copy link
Collaborator

@mgirlich mgirlich commented May 19, 2021

Fixes #238.

nesting() needs to be treated separately from other variables in expand() and the resulting data.table code quickly gets a bit ugly, in particular as there is no nice support for a cross join by data.table.

TODO

  • add tests
  • handle factors
  • add news
  • check if row order is the same as for dataframe

factors

When used with factors, expand() uses the full set of levels, not just those that appear in the data.

It is possible to handle factors the same way but not so nice because the type of a column is usually not known (respectively only when it wasn't mutated). I see two options to have the same behaviour for data.table as for dataframes:

  • use levels(x) %||% x for every column. This is quite ugly
  • define a special function and add it in front of the generated data.table code

@markfairbanks
Copy link
Collaborator

markfairbanks commented Jul 12, 2022

@mgirlich should this one be converted to a draft/work-in-progress? Did you run into some issues when implementing?

@markfairbanks markfairbanks marked this pull request as draft October 20, 2022 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support nesting()
2 participants