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

df_merge_rows: multi-function approach #49

Open
Deleetdk opened this issue Jan 30, 2017 · 0 comments
Open

df_merge_rows: multi-function approach #49

Deleetdk opened this issue Jan 30, 2017 · 0 comments

Comments

@Deleetdk
Copy link
Owner

Instead of supplying a single function that must work for all columns or all numeric columns, make it so one supplies either a function or a list of functions. If a function, it will be used on all columns. If a list of functions, it will use any function that matches the column name. If there is none, it will default to one for that type. This is a clever approach to handling mixed data data frames.

The default func should be something like:

list(.numeric = wtd_sum, .default = first_row)

So, given a column, it is tested for numerical status (integer or double). If yes, then the values are summed. If not, it defaults to .default and takes the first row. In this way, every column is processed. One can make it possible for there to be no function that applies, which raise an error that may be useful in some cases.

@Deleetdk Deleetdk changed the title df_merge_rows: multi-function options df_merge_rows: multi-function approach Jan 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant