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

Ordered data in create_table() #1

Open
jesse-smith opened this issue Nov 9, 2020 · 2 comments
Open

Ordered data in create_table() #1

jesse-smith opened this issue Nov 9, 2020 · 2 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@jesse-smith
Copy link
Owner

create_table() now attempts to order the input appropriately when coercing to factor. This seems to be working-ish, but there's a new issue of implicitly missing values in things like time. Type-stability of the output is starting to seem like more of a bug than a feature. To summarize:

  • Factors are currently always returned by create_table(). This allows us to nicely control plotting order in the plot_* functions.

  • Some information is lost when coercing to factors. This can be mitigating in principle but requires significant work to re-implement existing defaults (i.e. date plotting in ggplot2)

  • We want to maintain sensible plotting for factor-type data, but also use the defaults for non-factor-type data

@jesse-smith
Copy link
Owner Author

First thoughts:

  1. Given that the issue is a plotting problem, this should really be a discussion on the plot_* family, which means I've probably implemented type coercion in the wrong function (the plot_* family should probably do it, rather that the create_* family).

  2. The primary advantage of factors in plotting is that we can control ordering with levels. This makes sense for reordering categories based on frequency; less sense for others.

Potential fix

Move factor coercion to the plot_* family as a helper function. Add an infreq argument to that family and only use the helper when infreq = TRUE.

This will require a good bit of time to refactor.

@jesse-smith jesse-smith added the bug an unexpected problem or unintended behavior label Nov 9, 2020
@jesse-smith
Copy link
Owner Author

Actually, adding infreq will only be a switch to call the helper (or not). Since we're composing with pipes, it may be clearer to create a separate function that transforms the output of create_table() to a factor. This can then be passed to the plot_* family as usual. Benefits from chunking the conversion behavior separately from the plotting behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant