-
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_cumulative function for one-way tabyls #238
Comments
I guess |
I think this will be a useful addition to janitor, but it might have more complexity and require more care than I can devote for the 1.2 release. I'll try, though, and am marking this 1.2. |
This is still worthy but I can't get this done right in the next 24 hours, it will have to wait for some future release. Anyone's welcome to turn the above code into a PR with tests & addressing the issues with totals and formatting identified above. |
Hi @sfirke, I have been trying to add to the code you provided above, and wanted to share what I have in case it's useful. I think that this will work in any case where The only thing I can think of is to warn the user if the max column value falls within a threshold of the sum of the cumulative sum. Example:
This is obviously more of an issue with large datasets with rounded values. Anyway, hopefully this is useful and helps to implement Edit: Possibly add an
|
Any suggestions on how one could amend the above code for cumulative percentage? |
Suggested by @elinw in #231.
I am thinking this function takes a data.frame and a column name and appends a column that is the cumulative sum of that target column. It also takes an argument
dir
specifying whether the function should sum down from the top (default) or up from the bottom.The default case would be to run on the result of a one-way
tabyl
so in my version below, when the column name is not specified it first looks forvalid_percent
and thenpercent
. If both are present, should it generate two cumsum columns, or should it default tovalid_percent
?^^^ this works so try out the examples and give feedback in this issue!
The text was updated successfully, but these errors were encountered: