walkerke / census-with-r-book

Source for Analyzing US Census Data: Methods, Maps, and Models in R by Kyle Walker, published with CRC Press
https://walker-data.com/census-r
Other
79 stars 27 forks source link

use group_modify also for entropy calculation #3

Closed elbersb closed 3 years ago

elbersb commented 3 years ago

In light of https://github.com/elbersb/segregation/issues/8, this change uses group_modify() also for the entropy calculation. Or maybe entropy should also return a data frame? It would be more consistent with the overall design of the package. Would be interested in hearing what you think!

walkerke commented 3 years ago

Yes I like this better! I had a version of this in draft that hadn't quite made it in to the book, so a PR is excellent. Regarding implementation in your package - I think it works either way, though I agree that it may make sense for it to work the same way as your other functions like dissimilarity() do.