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

Moving from mmtable2() to gt() #8248

Closed
lilyclements opened this issue Mar 30, 2023 · 1 comment
Closed

Moving from mmtable2() to gt() #8248

lilyclements opened this issue Mar 30, 2023 · 1 comment
Assignees

Comments

@lilyclements
Copy link
Contributor

@anastasia-mbithe after a discussion with @rdstern we have agreed that we should forgo the flexibility that mmtable2 provides for gt() table directly. This is to allow for the flexibility that gt() offers.

Your work on the sub-dialogs is very impressive, and still holds really nicely so we don't need any changes on the sub dialogs from this move. In fact, doing this move will make things a lot easier on future sub-dialog code, and will add even more power to the tables!

The only changes are on the one variable, two/three variable, and (general) tables dialogs where we now remove all mmtable2 code.

E.g. we would replace

last_table <- mmtable2::mmtable(data=summary_table, cells=value) + mmtable2::header_left_top(variable='variable') + mmtable2::header_top_left(variable='summary')

with

last_table <- summary_table %>% gt()

I suggest we just focus on the "(general) tables" dialog for now, and can move to the other two later.

Changes:
There is one dialog change needed - and that is to remove the Column Factors nud and instead add in a set of rdos titled Column Factor.

If "Treat summaries as further factor" is not checked: Column Factor has three options -

  1. No column factor
  2. Factor variable (if checked, a single receiver is displayed. This should be restricted to only variables in the factors receiver - this is implemented in another dialog, I'm just trying to remember an example. Do you know?)
  3. Summary-Variable

If "Treat summaries as further factor" is checked: Column Factor has four options - the same two as above, but replace 3. with:
3. Summary
4. Variable

If 1. is checked, then the code is just:
summary_table %>% gt()

If 2. is checked, then the code is:

summary_table %>%
  pivot_wider(names_from = <variable in receiver>, values_from = value) %>%
  gt::gt()

If 3. is checked and "Treat summaries as further factor" is not checked, then the code is:

summary_table %>%
  pivot_wider(names_from = `summary-variable`, values_from = value) %>%
  gt::gt()

If 3 is checked and "Treat summaries as further factor" is checked, then the code is:

summary_table %>%
  pivot_wider(names_from = summary, values_from = value) %>%
  gt::gt()

If 4 is checked:

summary_table %>%
  pivot_wider(names_from = variable, values_from = value) %>%
  gt::gt()

Does this make sense?

@lilyclements
Copy link
Contributor Author

lilyclements commented May 2, 2023

I'll put here the places we want to make these changes

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

No branches or pull requests

3 participants