sapply(c('devtools','here','tidyverse'), require, character.only=T) knitr::opts_knit$set(root.dir = here()) load_all()
Is the by-county sum of divergence scores calculated wrt the bay area the same as the average of their within and between scores? if weighted by population?
First, original part 3 equation, but using bay instead of cbsa
div <- bay_race %>% mutate(div = divergence(white,black,hispanic,asian)) %>% group_by(county) %>% summarize(div = sum(div * (white+black+hispanic+asian)/ sum(white+black+hispanic+asian)))
try with decomp
div2 <- bay_race %>% select(hispanic:asian, county) %>% group_by(county) %>% decompose_divergence() %>% mutate(sum = within + between)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.