Subunit

Published

March 30, 2026

aff <- ccn:::get_pin("aff")

aff$fac |> 
  collapse::fcount(facility_type) |> 
  collapse::roworder(-N)
# A tibble: 7 × 2
  facility_type                         N
  <chr>                             <int>
1 Nursing home                      12682
2 Dialysis facility                  7248
3 Home health agency                 6919
4 Hospice                            5114
5 Hospital                           4576
6 Inpatient rehabilitation facility   396
7 Long-term care hospital             306
aff$sub |> 
  collapse::fcount(facility_type) |> 
  collapse::roworder(-N)
# A tibble: 2 × 2
  facility_type                         N
  <chr>                             <int>
1 Nursing home                       1151
2 Inpatient rehabilitation facility   738
aff$fac[cheapr::which_(aff$sub$parent %in_% aff$fac$ccn), ] |> 
  collapse::fcount(facility_type) |> 
  collapse::roworder(-N)
# A tibble: 7 × 2
  facility_type                         N
  <chr>                             <int>
1 Nursing home                        527
2 Dialysis facility                   358
3 Hospice                             318
4 Home health agency                  318
5 Hospital                            314
6 Inpatient rehabilitation facility    35
7 Long-term care hospital              17
aff$fac
# A tibble: 37,241 × 2
   ccn    facility_type
   <chr>  <chr>        
 1 001500 Hospice      
 2 001502 Hospice      
 3 001503 Hospice      
 4 001509 Hospice      
 5 001510 Hospice      
 6 001511 Hospice      
 7 001513 Hospice      
 8 001514 Hospice      
 9 001515 Hospice      
10 001517 Hospice      
# ℹ 37,231 more rows
aff$sub
# A tibble: 1,889 × 3
   ccn    parent facility_type                    
   <chr>  <chr>  <chr>                            
 1 01T011 010011 Inpatient rehabilitation facility
 2 01T033 010033 Inpatient rehabilitation facility
 3 01T092 010092 Inpatient rehabilitation facility
 4 01T100 010100 Inpatient rehabilitation facility
 5 01T104 010104 Inpatient rehabilitation facility
 6 01T113 010113 Inpatient rehabilitation facility
 7 01T114 010114 Inpatient rehabilitation facility
 8 01T139 010139 Inpatient rehabilitation facility
 9 01T144 010144 Inpatient rehabilitation facility
10 01T157 010157 Inpatient rehabilitation facility
# ℹ 1,879 more rows