Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export(get_financial_details_990)
export(get_financial_details_990ez)
export(get_foundation_ein)
export(get_grantmaking_details_990)
export(get_organization_ein)
export(get_organization_name_990)
export(get_scheduleO)
export(get_scheduleR)
Expand Down
48 changes: 48 additions & 0 deletions R/org_classify_description_texts.R
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,54 @@ get_organization_name_990 <- function(ein) {
return(organization_name)
}

#' Search for the EIN an organization given a name and U.S. state
#'
#' @param state_abbrev A two-letter U.S. state abbreviation (e.g., CA). This input should be character.
#' @param org_name The name of a nonprofit organization. This input should be character.
#'
#' @return If successful, the function returns the Employment Identification Number matching the organization name in the given state
#' @importFrom dplyr filter
#' @importFrom dplyr select
#' @importFrom dplyr arrange
#' @export

org_name_to_ein <- function(state_abbrev, org_name) {

if (!is.character(state_abbrev)) {

stop("Error: state_abbrev should be character.")

}

if (!is.character(org_name)) {

stop("Error: org_name should be characer.")

}

# require exact match for short names
if (nchar(org_name) < 5) {
arrange(desc(REVENUE_AMT))

# allow fuzzy match for longer names
} else {

possible_matches <- eo1 %>%
filter(STATE == state_abbrev) %>%
filter(agrepl(toupper(org_name), NAME, max.distance = 0.01)) %>%
select(NAME, STREET, CITY, STATE, REVENUE_AMT,INCOME_AMT,ASSET_AMT,EIN) %>%
arrange(desc(REVENUE_AMT))

}

if (nrow(possible_matches) == 0) {
ein <- NA
} else {
ein <- possible_matches$EIN[1]
}

return(ein)
}

#' Get Employer Identification Numbers (EINs) associated with foundations
#'
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# MapAgora

<!-- badges: start -->
[![R-CMD-check](https://github.com/snfagora/MapAgora/workflows/R-CMD-check/badge.svg)](https://github.com/snfagora/MapAgora/actions)
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
Expand Down Expand Up @@ -172,4 +171,4 @@ To cite **MapAgora**, use:

## Acknowledgements

We acknowledge support from the SNF Agora Institue and P3 Lab at the Johns Hopkins University.
We acknowledge the administrative and financial support from the SNF Agora Institute and P3 Lab at Johns Hopkins University.
2 changes: 1 addition & 1 deletion docs/articles/getting-IRS.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions docs/articles/getting-IRS_files/header-attrs-2.10/header-attrs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
document.addEventListener('DOMContentLoaded', function(e) {
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
var i, h, a;
for (i = 0; i < hs.length; i++) {
h = hs[i];
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
a = h.attributes;
while (a.length > 0) h.removeAttribute(a[0].name);
}
});
2 changes: 1 addition & 1 deletion docs/articles/getting-social-media-handles.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
document.addEventListener('DOMContentLoaded', function(e) {
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
var i, h, a;
for (i = 0; i < hs.length; i++) {
h = hs[i];
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
a = h.attributes;
while (a.length > 0) h.removeAttribute(a[0].name);
}
});
2 changes: 1 addition & 1 deletion docs/articles/getting-websites.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
document.addEventListener('DOMContentLoaded', function(e) {
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
var i, h, a;
for (i = 0; i < hs.length; i++) {
h = hs[i];
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
a = h.attributes;
while (a.length > 0) h.removeAttribute(a[0].name);
}
});
3 changes: 1 addition & 2 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ articles:
getting-IRS: getting-IRS.html
getting-social-media-handles: getting-social-media-handles.html
getting-websites: getting-websites.html
last_built: 2021-08-02T23:53Z
last_built: 2021-09-01T17:58Z

187 changes: 187 additions & 0 deletions docs/reference/get_organization_ein.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/reference/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions man/get_organization_ein.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.