Registered 501(c)(3) Private Foundations by State

9.6.2018
Deondre' Jones

More from this project:

Number of Registered 501(c)(3) Private Foundations by State

  1. library(tidyverse)
  2. library(httr)
  3. library(stringr)
  4. library(knitr)
  5. library(reshape2)
  6. library(extrafont)
  7. source('https://raw.githubusercontent.com/UrbanInstitute/urban_R_theme/master/urban_theme_windows.R')
  8.  
  9. #Create a function to filter out unneccesary columns from the Business Master File 
  10. prepbmffile <- function(bmffilepath) {
  11.   output <- read_csv(bmffilepath,
  12.                      col_types = cols_only(EIN = col_character(),
  13.                                            NTEECC = col_character(),
  14.                                            STATE = col_character(),                                         
  15.                                            OUTNCCS = col_character(),
  16.                                            SUBSECCD = col_character(),
  17.                                            FNDNCD = col_character(),
  18.                                            CFILER = col_character(),
  19.                                            CZFILER = col_character(),
  20.                                            CTAXPER = col_character(),
  21.                                            CTOTREV = col_double(),
  22.                                            CASSETS = col_double()
  23.                      ))
  24.   names(output) <- toupper(names(output))
  25.   return(output)
  26. }
  27.  
  28. #Run the function on the BMF
  29. bmf2016 <- prepbmffile("Data/bm1608.csv")
  30.  
  31. #Filter the bmf to isolate nonprofits that are actively filing
  32. output2<- bmf2016 %>%
  33.   #Filter out out of scope orgs
  34.   filter((OUTNCCS != "OUT")) %>%
  35.   filter((FNDNCD == "02" | FNDNCD == "03" | FNDNCD == "04")) %>%
  36.   #Filter out non 501(c)(3)s
  37.   filter(SUBSECCD =="03") %>%
  38.   #Filter out orgs that haven't filed taxes in the last 2 years
  39.   filter(CFILER == "Y") %>%
  40.   #filter(CZFILER == "N") %>%
  41.   #Total the filtered number of orgs and display by state
  42.   group_by(STATE)%>%
  43.   summarise(TotalActive = n())
  44.  
  45. #Filter the bmf to isolate number of nonprofits by state
  46. output <- bmf2016 %>%
  47.   #filter out of scope orgs
  48.   filter((OUTNCCS != "OUT")) %>% 
  49.   filter((FNDNCD == "02" | FNDNCD== "03" | FNDNCD == "04")) %>%
  50.   #Filter out non 501(c)(3)s
  51.   filter(SUBSECCD =="03") %>%
  52.   #Total the filtered number of orgs and display by state
  53.   group_by(STATE) %>%
  54.   summarize(TotalOrgs = n())
  55.  
  56. #join the two output files to a single table
  57. final <- left_join(output, output2, by = "STATE")
  58.  
  59. #Add in full state names
  60. final <- final %>%
  61.   mutate(State = state.name[match(STATE, state.abb)])
  62.  
  63. #DC isn't recognized as a state and displays as N/A. This function renames it.
  64. final$State[final$STATE =="DC"] <- "Washington, DC"
  65.  
  66. #Rearrange the table and drop the state abbreviation column
  67. final <- final %>%
  68.   select(State, TotalOrgs, TotalActive)
  69.  
  70. #Arrange states in alphabetical order
  71. final <- final[order(final$State),]
  72.  
  73. #rename columns appropriately 
  74. colnames(final)<- c("State", "Number of Organizations", "Number Filing Annually")
  1. #display table
  2. kable(final, format.args = list(decimal.mark = '.', big.mark = ","))
State Number of Organizations Number Filing Annually
Alabama 1,172 1,087
Alaska 123 107
Arizona 1,217 1,080
Arkansas 493 431
California 10,875 9,920
Colorado 1,865 1,690
Connecticut 1,853 1,749
Delaware 1,494 1,433
Florida 6,819 6,188
Georgia 2,158 1,916
Hawaii 487 450
Idaho 364 327
Illinois 5,934 5,616
Indiana 1,431 1,316
Iowa 1,076 1,018
Kansas 912 851
Kentucky 773 694
Louisiana 832 715
Maine 495 461
Maryland 1,939 1,754
Massachusetts 3,684 3,480
Michigan 2,690 2,466
Minnesota 1,603 1,500
Mississippi 403 356
Missouri 1,621 1,489
Montana 351 328
Nebraska 692 660
Nevada 778 694
New Hampshire 532 502
New Jersey 3,555 3,285
New Mexico 425 373
New York 11,948 11,154
North Carolina 4,285 4,098
North Dakota 143 126
Ohio 3,820 3,556
Oklahoma 1,062 970
Oregon 912 840
Pennsylvania 5,471 5,196
Rhode Island 1,769 1,744
South Carolina 765 678
South Dakota 207 186
Tennessee 1,207 1,074
Texas 6,466 5,894
Utah 936 833
Vermont 297 272
Virginia 2,045 1,821
Washington 1,712 1,540
Washington, DC 531 484
West Virginia 380 338
Wisconsin 2,490 2,356
Wyoming 313 286

Source: NCCS 501(c)(3) IRS Business Master File 2016