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

Sorting #104

Closed
5 tasks done
1beb opened this issue Apr 27, 2020 · 0 comments
Closed
5 tasks done

Sorting #104

1beb opened this issue Apr 27, 2020 · 0 comments
Assignees
Milestone

Comments

@1beb
Copy link
Collaborator

1beb commented Apr 27, 2020

This is a post-processing action that should happen after the call to crosstabs but before the call to writeLatex or writeExcel. It is expected that there will be many exceptional cases. It would be simple to apply, crosstab wide, a sort. However, it's likely that groups of variables will need to be sorted in the same way. This suggests that a passthrough function with a list of variables included would be the clearest method for the user. Although themeNew already has infrastructure for this type of formatting, we feel that it is already too complex additional functionality that manages the structure of the data in addition to the visual presentation would be confusing for the user.

Add two functions:

sort_alpha(ct, vars, descending, pin_to_top, pin_to_bottom)
sort_numeric(ct, vars, descending, pin_to_top, pin_to_bottom)

Usage example:

ct = crosstabs(ds) 
ct = sort_numeric(ct, vars)
writeLatex()

The function acts as a passthrough that could be applied to a group of variables or to a single variable allowing us to create exceptions.

ct = crosstabs(ds) 
ct = sort_numeric(ct, vars=c("a", "b"))
ct = sort_numeric(ct, vars=c("c"), pin_to_bottom = "Don't know")
writeLatex(ct)
  • Update vignette with sorting example
  • Tests for sort_numeric
  • Tests for sort_alpha
  • Add functions sort_numeric and sort_alpha (likely a generic with a sort type flag)
  • Works for toplines categorical, categorical_array
@1beb 1beb self-assigned this Apr 28, 2020
@1beb 1beb added this to the Release 1.2.6 milestone May 12, 2020
1beb added a commit that referenced this issue May 13, 2020
@1beb 1beb closed this as completed May 13, 2020
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

1 participant