ropensci / iheatmapr

Complex, interactive heatmaps in R
https://docs.ropensci.org/iheatmapr
Other
267 stars 35 forks source link

sum option in add_col_summary() & add_row_summary() #27

Closed CB1789 closed 6 years ago

CB1789 commented 6 years ago

Great package!

I'm looking to do something that doesn't seem possible after reading the add_col_summary() and add_row_summary() documentation, which state that the "summary function default is mean, options are mean, median, sd, var, mad, max, min"

It would be very useful to have a sum argument feature for the column and row summaries, particularly when adding a subplot across the top of the heatmap columns. For instance, to sum the population of states by year over time.

If I've missed this feature or its implementation please let me know where to look in the documentation.

Thanks!

AliciaSchep commented 6 years ago

Thanks for bringing up this question, it was missing functionality -- I've added 'sum' as an option in v0.4.4 (you can update by using devtools::install_github -- not sure when I'll do another cran release).

Note for future: it might be worth allowing any function, including user-defined, for the summary functions. I vaguely remember deciding against this at some earlier point, but don't remember why and am struggling to think of why that would be a problem.

mschilli87 commented 6 years ago

@AliciaSchep

I vaguely remember deciding against this at some earlier point, but don't remember why and am struggling to think of why that would be a problem.

for reference: https://github.com/ropensci/iheatmapr/issues/10#issuecomment-315667304 :wink:

AliciaSchep commented 6 years ago

Thanks @mschilli87 for the reminder!

CB1789 commented 6 years ago

@AliciaSchep

Thanks very much for the quick response, and for adding sum as an option to the summary functions. I've updated to v 0.4.4 and put it to use already. Makes a great package even better!

Thanks again, and thank you for all you do for the community.