I have this tibble derived from {tidycensus}'s American Community Survey data.
tibble::tribble(
~tenure_type, ~race_eth_type, ~count, ~moe,
"Owner occupied", "ALL", 76444810, 367132,
"Renter occupied", "ALL", 43285318, 139467,
"Owner occupied", "BLACK OR AFRICAN AMERICAN ALONE HOUSEHOLDER", 6131359, 45617,
"Renter occupied", "BLACK OR AFRICAN AMERICAN ALONE HOUSEHOLDER", 8552346, 29687,
"Owner occupied", "WHITE ALONE, NOT HISPANIC OR LATINO HOUSEHOLDER", 58423846, 226380,
"Renter occupied", "WHITE ALONE, NOT HISPANIC OR LATINO HOUSEHOLDER", 22993331, 82321
)
I want to group by tenure_type and generate rows for a new race_eth_type called "OTHER". For each tenure type, count will equal the count for "ALL" minus the counts for "BLACK..." and "WHITE..." (76444810 - 6131359 - 58423846 = 11889605, etc). moe would be generated using tidycensus::moe_sum.
Maybe my brain is just overly fatigued, but I can't figure out how to do this.