ipums / ipumsr

Request, download, and read IPUMS data in R
https://tech.popdata.org/ipumsr/
Mozilla Public License 2.0
20 stars 4 forks source link

Return all when case_selection_type is "detailed" and no selections specified #52

Closed probablynotimportant closed 11 months ago

probablynotimportant commented 11 months ago

For example, the detailed race could be of value for looking at multiple groups and having a dataset that can be filtered through versus several subset pulls or a hodgepodge set that may not address questions without multiple iterations. Is there anyway to improve usability to allow for detailed to be selected and all be returned. This can be manually built but that is considerable tedium.

Current default behavior: var_spec("RACE", case_selection_type= "detailed", case_selections =c('must include exactly'))

Revised default behavior: var_spec("RACE", case_selection_type= "detailed", case_selections ="all, unless you list specific codes"))

dtburk commented 11 months ago

Thanks for using ipumsr and creating this issue!

Please correct me if I'm misunderstanding you, but it sounds like you want your extract to include the detailed version of the RACE variable, and you want it to include persons of all races.

If that's the case, then you don't need to specify any case selection options for the RACE variable. Just include RACE in your variables argument, either as "RACE" or var_spec("RACE"), and depending on the IPUMS collection, your extract will include all the detailed race codes in a variable called "RACE" or "RACED" (IPUMS CPS and IPUMS International include all the detailed codes in the "RACE" variable, whereas IPUMS USA adds a separate variable "RACED" to your extract that contains the detailed codes).

Case selection specifications are only necessary when you want to limit your data to cases that match certain criteria. If you want to include all cases, you don't need any case selections.

probablynotimportant commented 11 months ago

Thanks so much! I misunderstood the general and detailed operations. I am seeing both get brought down when I pull with just race.