mountainMath / cancensus

R wrapper for calling CensusMapper APIs

Home Page:https://mountainmath.github.io/cancensus/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

option to keep parent in output of child_census_vectors()

dshkol opened this issue · comments

I believe the most common use case for child_census_vectors() is to generate a list of downstream hierarchy vectors given an input and it works well there. One version of this that frequently comes up is to calculate proportions by dividing the children values by the upstream parent one. This is easy enough to do as is, but requires appending the parent vector to the result of the call. We can streamline this a bit by including an option like 'keep_parent = TRUE in the call to retain the parent vector as well.

Sounds good to me. I usually solve this by doing %>% bind_rows(child_census_vectors(.)) if I want to keep the parent, but I agree that having an option makes this cleaner and more transparent.

On this, we should also just give an option to return the vector codes only. I do this basically everytime: %>% pull(vector))

This was added in #167