ropensci / coder

Classification of Cases into Deterministic Categories
https://docs.ropensci.org/coder/
22 stars 4 forks source link

Rename index and visualize #123

Closed eribul closed 4 years ago

eribul commented 4 years ago

index and especially visualize are very generic names for very specific functions, and doesn't give any hints about what they're used for. How about visualize_classcodes?

eribul commented 4 years ago

Review: I agree that visualize is actually a S3-method for generics::visualize() with the aim to "Visualize a data set or object". I was just a little hesitant to depend on generics initially due to its "lifecycle: experimental" batch on GitHub. It is released on CRAN, however, and it is supposed to be a lightweight package with the specific purpose to be used in exactly those circumstances. I have therefore refactored accordingly.

eribul commented 4 years ago

Review: I am less confident that the index function is that specific since its meaning will differ depending on different classcodes object. The terminology is borrowed from the typical use case of calculating a comorbidity index, which was the initial motif for developing the package (compare "Charlson comorbidity index", "Elixhauser comorbidity index" and "Rxrisk V comorbidity index) for example. Similar verbs would be for example "count" or "summarize" or similar but those are used in dplyr, which would be confusing. index on the other hand is not used in any widely used package as from what I have seen. Another alternative might be weighted_sum or similar but I do prefer the verb form here (and I think calculate_weighted_sum is unnecessarily cumbersome).