-
Notifications
You must be signed in to change notification settings - Fork 130
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
adorn_crosstab's helper functions always skip the first column #57
Comments
I guess the latter? Here's a good use case for this: |
I kind of went with a hybrid. For the other two, So, first column always gets skipped and the word "Total" placed at the bottom. But other non-numeric columns can occur in any position, mixed in among numeric vectors. This could be nice, say if a data source has a right-most text column but you still want a totals row. Oh and if there are those additional non-numeric columns, and you call @rgknight what do you think about that approach for the three functions, in particular
to play around with. Then if you are good with it, I'll write tests and merge it in pending Travis/codecov. But I didn't want to write tests yet in case you had other thoughts re: how these should work. |
For version 0.X: I think For version 1.0: I think there are two potential approaches that will work well here. One is to make everything an option instead of a helper function, and the other is to create a short prefix for all These would both mean moving away from making these fully-featured export functions. I think you will get into trouble if you start trying to support use cases for these functions other than modifying a If these were options, I would use:
Then (Random thought: maybe we eliminate the split and just split on grouped vars when df is a grouped_df. Might be a bad idea though). The second approach would be to make these all start with something like
Or something like that, which would let us add multiple values under |
Yeah I like the I never loved "adorn" but at least that word is short and isn't used widely - and I couldn't think of a better one. Well maybe I should take this to the 1.0 version on the "improve_adorn_helpers" branch, make both of the add_totals functions into a single function |
For consistency, should |
@rgknight I'm grateful for your vision for 1.0 and a cleaner API, at the expense of some small helper functions or trying to do everything. The more I think about it, the more I am convinced it's the way to go. |
:-) Very glad that you have found this helpful. Huge props to you for being open to the feedback. It's not at all easy to open up your vision in this way! I really like |
Whew I got the two
@rgknight thoughts on keeping it as |
I'll just go with |
add_totals_row
,add_totals_col
, andns_to_percents
all have it hard-coded that the first column is a character vector to be ignored. Fine when they were non-exported helper functions foradorn_crosstab
, but if exported, this should be more flexible. There could be multiple non-numeric columns, in any order, or none.Default to skipping an arbitrarily-wide number of initial non-numeric columns? Or detect non-numeric columns, and exclude (for summing) or leave as is (for in-place conversion to percentages)?
The text was updated successfully, but these errors were encountered: