idblr / ndi Goto Github PK
View Code? Open in Web Editor NEWCompute various geospatial neighborhood deprivation indices
License: Other
Compute various geospatial neighborhood deprivation indices
License: Other
hey @idblr! I've been doing more testing and found something curious that I'm hoping you can straighten out for me.
df <- ndi::powell_wiley(geo = "county", state = "MO", year = 2020, round_output = FALSE)[[1]]
df <- dplyr::arrange(df, NDI)
On rows 69 and 70 of the resulting df
object, Barry County (29009
) gets a score of 0.24683105
while Sullivan County (29211
) gets a score of 0.26129508
. However, in NDIQunit
, Barry County is given 4-AboveAvg deprivation
while Sullivan is given 3-Average deprivation
.
This is possible because the log of the total population is factored into the ranking process, correct?
Hy,
While checking the codes, I am seeing the krieger function is not working. How can I resolve this issue?
Error in krieger(state = "TX", year = 2020) :
could not find function "krieger"
Thanks
Rasel
If Sys.getenv("CENSUS_API_KEY") != ""`, the tests are not skipped, and are not silent:
> nzchar(Sys.getenv("CENSUS_API_KEY"))
[1] TRUE
> anthopolos(state = "DC", year = 2020, subgroup = c("NHoLB", "HoLB"))
|======================================================================| 100%
$ri
# A tibble: 206 × 8
GEOID state county tract RI Total…¹ NHoLB HoLB
<chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
1 11001000101 District of Columbia District o… 1.01 0.0390 1250 0 0
2 11001000102 District of Columbia District o… 1.02 0.0413 3318 34 0
3 11001000201 District of Columbia District o… 2.01 0.0457 3972 239 8
4 11001000202 District of Columbia District o… 2.02 0.0371 4665 131 11
5 11001000300 District of Columbia District o… 3 0.0536 6504 178 0
6 11001000400 District of Columbia District o… 4 0.0495 1481 32 0
7 11001000501 District of Columbia District o… 5.01 0.101 3343 233 0
8 11001000502 District of Columbia District o… 5.02 0.0616 3580 150 20
9 11001000600 District of Columbia District o… 6 0.0749 4942 411 0
10 11001000702 District of Columbia District o… 7.02 0.0763 2971 335 0
# … with 196 more rows, and abbreviated variable name ¹TotalPop
# ℹ Use `print(n = ...)` to see more rows
$missing
# A tibble: 3 × 4
variable total n_missing percent_missing
<chr> <int> <int> <chr>
1 HoLB 206 0 0 %
2 NHoLB 206 0 0 %
3 TotalPop 206 0 0 %
> bravo(state = "DC", year = 2009, subgroup = c("LtHS", "HSGiE"))
|======================================================================| 100%
$ei
# A tibble: 188 × 24
GEOID state county tract EI Total…¹ mNSC mNt4G m5t6G m7t8G m9G m10G
<chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 110010… Dist… Distr… 1 0.0524 3882 0 0 0 0 0 0
2 110010… Dist… Distr… 2.01 0.0522 127 0 0 0 0 0 0
3 110010… Dist… Distr… 2.02 0.0442 2371 0 0 0 0 0 0
4 110010… Dist… Distr… 3 0.0732 3563 0 0 0 0 0 0
5 110010… Dist… Distr… 4 0.0832 1099 0 0 0 0 0 0
6 110010… Dist… Distr… 5.01 0.0809 2426 0 0 0 0 0 0
7 110010… Dist… Distr… 5.02 0.0942 2471 0 0 7 0 0 0
8 110010… Dist… Distr… 6 0.104 4436 10 0 8 37 0 146
9 110010… Dist… Distr… 7.01 0.114 3782 0 0 0 0 26 0
10 110010… Dist… Distr… 7.02 0.0805 2237 0 0 0 33 0 0
# … with 178 more rows, 12 more variables: m11G <dbl>, m12GND <dbl>,
# mHSGGEDoA <dbl>, fNSC <dbl>, fNt4G <dbl>, f5t6G <dbl>, f7t8G <dbl>,
# f9G <dbl>, f10G <dbl>, f11G <dbl>, f12GND <dbl>, fHSGGEDoA <dbl>, and
# abbreviated variable name ¹TotalPop
# ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
$missing
# A tibble: 19 × 4
variable total n_missing percent_missing
<chr> <int> <int> <chr>
1 f10G 188 0 0 %
2 f11G 188 0 0 %
3 f12GND 188 0 0 %
4 f5t6G 188 0 0 %
5 f7t8G 188 0 0 %
6 f9G 188 0 0 %
7 fHSGGEDoA 188 0 0 %
8 fNSC 188 0 0 %
9 fNt4G 188 0 0 %
10 m10G 188 0 0 %
11 m11G 188 0 0 %
12 m12GND 188 0 0 %
13 m5t6G 188 0 0 %
14 m7t8G 188 0 0 %
15 m9G 188 0 0 %
16 mHSGGEDoA 188 0 0 %
17 mNSC 188 0 0 %
18 mNt4G 188 0 0 %
19 TotalPop 188 0 0 %
Great work on ndi
, @idblr!
I'd love to integrate your package into some existing workflows, but would like to be able to pass a data frame of correctly prepped/formatted data to messer()
or one of the other functions.
The sociome
package has a great workaround that allows this, the calculate_adi()
function. Instead of calling the main get_adi()
function that downloads the data and calculates ADI, users with pre-existing data can skip the download step by calling calculate_adi()
directly.
I'm wondering if you'd be open to a PR that would create (as an example) a calculate_messer()
function that messer()
would call as a subfunction after data download and prep. I would also export it so that other workflows could call it directly. I'm most interested in this for messer()
and powell_wiley()
, but would happily write it for anthopolos()
, bravo()
, and krieger()
as well (doesn't make sense to do it for gini()
). Thanks for considering!
One additional question that popped up in messer()
is the rounding that takes place at the end. I'm sure you had a reason for doing it! Just curious your thoughts about whether that should be optional?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.