Largest Active and Reporting Environmental Public Charities by End of Year Assets
9.5.2018
More from this project:
Largest Active and Reporting Environmental Public Charities by End of Year Assets
library(tidyverse)
library(knitr)
library(stringr)
library(scales)
library(httr)
source('https://raw.githubusercontent.com/UrbanInstitute/urban_R_theme/master/urban_theme_windows.R')
#Create NTEE grouping categories
arts <- c("A")
highered <- c("B4", "B5")
othered <- c("B")
envanimals <- c("C", "D")
hospitals <- c('E20','E21','E22','E23','E24','F31','E30','E31','E32')
otherhlth <- c("E", "F", "G", "H")
humanserv <- c("I", "J", "K", "L", "M", "N", "O", "P")
intl <- c("Q")
pubben <- c("R", "S", "T", "U", "V", "W", "Y", "Z")
relig <- c("X")
#Import the Reduced NCCS Data Archive
nteedocalleins <- read.csv("Data/nteedocalleins.csv")
#convert variable names to upper case
names(nteedocalleins) <- toupper(names(nteedocalleins))
#This function will apply the most common NTEE Grouping categories to your data.
NTEEclassify <- function(dataset) {
#merge in Master NTEE look up file
dataset <- dataset %>%
left_join(nteedocalleins, by = "EIN")
#create NTEEGRP classifications
dataset$NTEEGRP <- " "
dataset$NTEEGRP[str_sub(dataset$NTEEFINAL,1,1) %in% arts ] <- "Arts"
dataset$NTEEGRP[str_sub(dataset$NTEEFINAL,1,1) %in% othered ] <- "Education: Other"
dataset$NTEEGRP[str_sub(dataset$NTEEFINAL,1,2) %in% highered ] <- "Education: Higher"
dataset$NTEEGRP[str_sub(dataset$NTEEFINAL,1,1) %in% envanimals] <- "Environment and Animals"
dataset$NTEEGRP[str_sub(dataset$NTEEFINAL,1,1) %in% otherhlth] <- "Health Care: Other"
dataset$NTEEGRP[str_sub(dataset$NTEEFINAL,1,3) %in% hospitals] <- "Health Care: Hospitals and primary care facilities"
dataset$NTEEGRP[str_sub(dataset$NTEEFINAL,1,1) %in% humanserv] <- "Human Services"
dataset$NTEEGRP[str_sub(dataset$NTEEFINAL,1,1) %in% intl] <- "International"
dataset$NTEEGRP[str_sub(dataset$NTEEFINAL,1,1) %in% pubben] <- "Other Public and social benefit"
dataset$NTEEGRP[str_sub(dataset$NTEEFINAL,1,1) %in% relig] <- "Religion related"
dataset$NTEEGRP[is.na(dataset$NTEEFINAL)] <- "Other Public and social benefit"
return(dataset)
}
#Import reduced NCCS Core File Function
prepcorepcfile <- function(corefilepath) {
output <- read_csv(corefilepath,
col_types = cols_only(EIN = col_character(),
FISYR = col_integer(),
NAME = col_character(),
STATE = col_character(),
ADDRESS = col_character(),
CITY = col_character(),
ZIP = col_character(),
MSA_NECH = col_character(),
FIPS = col_character(),
PMSA = col_character(),
STYEAR = col_double(),
TAXPER = col_integer(),
OUTNCCS = col_character(),
OutNCCS = col_character(),
SUBSECCD = col_character(),
RULEDATE = col_character(),
FNDNCD = col_character(),
FRCD = col_character(),
TOTREV = col_double(),
EXPS = col_double(),
ASS_EOY = col_double(),
GRREC = col_double()
))
names(output) <- toupper(names(output))
return(output)
}
#Import NCCS Core File for given year
corefile <- prepcorepcfile(as.character(paste("Data/core", "2015", "pc.csv", sep="")))
#Add NTEE Classifications to the Core File
corefile <- NTEEclassify(corefile)
#Filter out of scope organizations
corefile <- corefile %>%
filter((OUTNCCS != "OUT")) %>%
filter((FNDNCD != "02" & FNDNCD!= "03" & FNDNCD != "04")) %>%
filter((NTEEGRP == "Environment and Animals"))
#Sort the corefile in descending order by EOY Assets
LargestAssets <- corefile[with(corefile,order(-ASS_EOY)),]
#Limit the list to 10
LargestAssets <- LargestAssets[1:10,]
#Select the appropriate columns, drop the rest
LargestAssets <- LargestAssets %>%
select(EIN, NTEEFINAL, NTEEGRP, NAME, ASS_EOY)
#Rename columns appropriately
colnames(LargestAssets) <- c("EIN", "NTEE Code", "NTEE Group", "Name", "End of Year Assets")
#display table
kable(LargestAssets, format.args = list(decimal.mark = '.', big.mark = ","))
EIN | NTEE Code | NTEE Group | Name | End of Year Assets |
---|---|---|---|---|
530193519 | C60 | Environment and Animals | NATIONAL GEOGRAPHIC SOCIETY | 1,695,152,141 |
521384139 | D30 | Environment and Animals | NATIONAL FISH AND WILDLIFE FOUNDATION | 1,345,544,846 |
131740011 | D50 | Environment and Animals | WILDLIFE CONSERVATION SOCIETY | 1,033,547,676 |
521388917 | C34 | Environment and Animals | THE CONSERVATION FUND A NONPROFIT CORPORATION | 717,760,621 |
131693134 | C41 | Environment and Animals | NEW YORK BOTANICAL GARDEN | 580,487,363 |
951648219 | D50 | Environment and Animals | ZOOLOGICAL SOCIETY OF SAN DIEGO | 545,207,267 |
582574918 | D50 | Environment and Animals | GEORGIA AQUARIUM INC | 474,856,953 |
521693387 | D30 | Environment and Animals | WORLD WILDLIFE FUND INC | 471,481,440 |
131624102 | C30 | Environment and Animals | NATIONAL AUDUBON SOCIETY INC | 471,019,435 |
942487469 | D1150 | Environment and Animals | MONTEREY BAY AQUARIUM FOUNDATION | 387,639,444 |
Source: NCCS 501(c)(3) Public Charities Core File 2015