Information about the data themselves may be found on the US CDC web site.
Convenience functions are provided to filter the data based on age categories and values. These functions drop extraneous fields which arise, e.g. the adult subset loses the newborn flag.
There is no newborn field in the adult subset, and age
is renamed to age_years
. nhds_adults()
and nhds_adult()
are synonymous.
nhds_adult()[1:5, 1:7]
#> id age_years sex race marital_status dc_month dc_status
#> 1 1 19 female white not_stated 2 home
#> 2 2 20 female black single 8 home
#> 4 4 44 female black not_stated 8 home
#> 6 6 80 female not_stated not_stated 10 home
#> 7 7 66 male white not_stated 6 short_term
Pediatric data retains age
and age_unit
, as age is specified in days, months or years. nhds_pediatric()
and nhds_peds()
are synonymous.
nhds_pediatric()[11:20, c("age_unit", "age")]
#> age_unit age
#> 51 days 0
#> 55 days 0
#> 62 days 0
#> 67 months 4
#> 72 days 0
#> 76 days 0
#> 78 days 0
#> 83 days 0
#> 88 years 17
#> 96 days 0
nhds_pediatric()[1:5, 1:7]
#> id newborn age_unit age sex race marital_status
#> 3 3 TRUE days 0 male white single
#> 5 5 FALSE years 9 male not_stated single
#> 11 11 TRUE days 0 female white single
#> 16 16 FALSE years 3 female white single
#> 18 18 FALSE years 16 male white single
Infants’ ages may be in days or months.
nhds_infant()[111:115, 1:7]
#> id newborn age_unit age sex race marital_status
#> 937 937 FALSE days 1 male not_stated not_stated
#> 938 938 FALSE days 1 male white single
#> 955 955 TRUE days 0 female not_stated single
#> 971 971 TRUE days 0 male white single
#> 972 972 TRUE days 0 female white single
Although an infant age 29-31 days is not a neonate by definition, all non-neonate infants have ages measured in months, and there are not patients with age recorded as 29-31 days. This may mean one month of age is recorded for these patients.
i <- nhds_infant()
nrow(i[i$age_unit == "days" & i$age > 28, ])
#> [1] 0
nhds_infant_not_neonate()[1:5, 1:7]
#> id age_unit age sex race marital_status dc_month
#> 67 67 months 4 male white single 1
#> 135 135 months 2 female white not_stated 8
#> 171 171 months 1 male white single 12
#> 240 240 months 4 female white single 12
#> 316 316 months 1 female white single 7
Neonates (but not newborns) sometimes have marital status recorded as being not single. This appears to be an artifact, but left as is. Newborn patients and the ‘newborn’ field are redundant when using nhds_neonatal_not_newborn()
. nhds_neonatal()
and nhds_neonate()
are synonyms. Same for nhds_neonatal_not_newborn()
and nhds_neonate_not_newborn()
.
nhds_neonatal()[which(!(nhds_neonatal()$marital_status %in% c("single", "not_stated"))), 1:7]
#> id newborn age_days sex race marital_status dc_month
#> 5667 5667 FALSE 19 male white divorced 9
#> 147516 147516 FALSE 18 female black separated 2
nhds_neonatal_not_newborn()[1:5, 1:7]
#> id age_days sex race marital_status dc_month dc_status
#> 237 237 1 female white single 5 home
#> 250 250 12 female white not_stated 10 home
#> 374 374 11 male white not_stated 3 home
#> 476 476 7 female black not_stated 6 home
#> 616 616 1 female white single 9 home
All newborns have age of zero days recorded, so this field is dropped. nhds_newborn()
and nhds_newborns()
are synonymous.
summary(nhds2010)
#> id newborn age_unit age
#> Length:151551 Mode :logical years :135418 Min. : 0.00
#> Class :character FALSE:137459 months: 1313 1st Qu.:29.00
#> Mode :character TRUE :14092 days : 14820 Median :54.00
#> Mean :49.89
#> 3rd Qu.:73.00
#> Max. :90.00
#>
#> sex race marital_status
#> male :63603 white :95444 married :26024
#> female:87948 not_stated :24543 single :31794
#> black :20963 widowed : 9020
#> other : 7929 divorced : 4936
#> asian : 2090 separated : 729
#> native_continental: 370 not_stated:79048
#> (Other) : 212
#> dc_month dc_status care_days dc_same_day
#> Min. : 1.000 home :116757 Min. : 1.000 Mode :logical
#> 1st Qu.: 3.000 AMA : 1547 1st Qu.: 2.000 FALSE:149014
#> Median : 6.000 short_term: 3862 Median : 3.000 TRUE :2537
#> Mean : 6.385 long_term : 15667 Mean : 4.673
#> 3rd Qu.: 9.000 alive_NOS : 7028 3rd Qu.: 5.000
#> Max. :12.000 dead : 2784 Max. :497.000
#> not_stated: 3906
#> region n_beds hospital_ownership weighting
#> northeast:28563 6-99 :24684 proprietary: 20257 Min. : 18.0
#> midwest :45631 100-199:29867 government : 20747 1st Qu.: 88.0
#> south :61729 200-299:24121 non_profit :110547 Median : 125.0
#> west :15628 300-499:45596 Mean : 256.8
#> 500+ :27283 3rd Qu.: 235.0
#> Max. :3000.0
#>
#> dx01 dx02 dx03
#> Length:151551 Length:151551 Length:151551
#> Class1:icd9cm Class1:icd9cm Class1:icd9cm
#> Class2:icd9 Class2:icd9 Class2:icd9
#> Class3:character Class3:character Class3:character
#> Mode :character Mode :character Mode :character
#>
#>
#> dx04 dx05 dx06
#> Length:151551 Length:151551 Length:151551
#> Class1:icd9cm Class1:icd9cm Class1:icd9cm
#> Class2:icd9 Class2:icd9 Class2:icd9
#> Class3:character Class3:character Class3:character
#> Mode :character Mode :character Mode :character
#>
#>
#> dx07 dx08 dx09
#> Length:151551 Length:151551 Length:151551
#> Class1:icd9cm Class1:icd9cm Class1:icd9cm
#> Class2:icd9 Class2:icd9 Class2:icd9
#> Class3:character Class3:character Class3:character
#> Mode :character Mode :character Mode :character
#>
#>
#> dx10 dx11 dx12
#> Length:151551 Length:151551 Length:151551
#> Class1:icd9cm Class1:icd9cm Class1:icd9cm
#> Class2:icd9 Class2:icd9 Class2:icd9
#> Class3:character Class3:character Class3:character
#> Mode :character Mode :character Mode :character
#>
#>
#> dx13 dx14 dx15
#> Length:151551 Length:151551 Length:151551
#> Class1:icd9cm Class1:icd9cm Class1:icd9cm
#> Class2:icd9 Class2:icd9 Class2:icd9
#> Class3:character Class3:character Class3:character
#> Mode :character Mode :character Mode :character
#>
#>
#> pc01 pc02 pc03
#> Length:151551 Length:151551 Length:151551
#> Class1:icd9cm_pc Class1:icd9cm_pc Class1:icd9cm_pc
#> Class2:icd9 Class2:icd9 Class2:icd9
#> Class3:character Class3:character Class3:character
#> Mode :character Mode :character Mode :character
#>
#>
#> pc04 pc05 pc06
#> Length:151551 Length:151551 Length:151551
#> Class1:icd9cm_pc Class1:icd9cm_pc Class1:icd9cm_pc
#> Class2:icd9 Class2:icd9 Class2:icd9
#> Class3:character Class3:character Class3:character
#> Mode :character Mode :character Mode :character
#>
#>
#> pc07 pc08 payor_primary
#> Length:151551 Length:151551 Medicare :60674
#> Class1:icd9cm_pc Class1:icd9cm_pc Medicaid :28195
#> Class2:icd9 Class2:icd9 HMO or PPO :21293
#> Class3:character Class3:character other private insurance:13570
#> Mode :character Mode :character blue cross blue shield :13197
#> self pay : 7335
#> (Other) : 7287
#> payor_secondary DRG adm_type
#> other private insurance: 11319 Length:151551 emergency :73267
#> Medicaid : 10386 Class :character urgent :23645
#> self pay : 10112 Mode :character elective :34700
#> blue cross blue shield : 7037 newborn :14092
#> HMO or PPO : 4209 trauma : 0
#> (Other) : 5197 not_stated: 5847
#> NA's :103291
#> adm_origin dx_adm
#> Non-health care POA :62565 Length:151551
#> Emergency room :48050 Class1:icd9cm
#> Newborn, born inside this hospital:11613 Class2:icd9
#> Clinic : 9143 Class3:character
#> Not available : 9089 Mode :character
#> Transfer from a hospital : 5905
#> (Other) : 5186