if (solved == 1) {
break
}
}
for (i_1 in 1:5) {
o_i_1<- operations[[i_1]]
for (i_2 in 1:5) {
o_i_2<- operations[[i_2]]
for (i_3 in 1:5) {
o_i_3<- operations[[i_3]]
for (i_4 in 1:5) {
o_i_4<- operations[[i_4]]
for (i_5 in 1:5) {
o_i_5<- operations[[i_5]]
for (i_6 in 1:5) {
o_i_6<- operations[[i_6]]
for (i_7 in 1:5) {
o_i_7<- operations[[i_7]]
for (i_8 in 1:5) {
o_i_8<- operations[[i_8]]
r<- p10958(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
if (r == 10958) {
solved<- 1
solution<- c(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
break
}
else {
solved<- 0
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
answerholder<- rep(NA, 3963)
?mo
? mod
?Mod
Mod(10, 2)
mod(2, 10)
Mod(10)
mod(11)
Mod(11)
10 %% 3
b <- 111 mod 10
b <- 111 %% 10
operations<- c(concatenate, add, subtract, multiply, divide)
counter<- 0
answerholder<- rep(NA, 3963)
for (i_1 in 1:5) {
o_i_1<- operations[[i_1]]
for (i_2 in 1:5) {
o_i_2<- operations[[i_2]]
for (i_3 in 1:5) {
o_i_3<- operations[[i_3]]
for (i_4 in 1:5) {
o_i_4<- operations[[i_4]]
for (i_5 in 1:5) {
o_i_5<- operations[[i_5]]
for (i_6 in 1:5) {
o_i_6<- operations[[i_6]]
for (i_7 in 1:5) {
o_i_7<- operations[[i_7]]
for (i_8 in 1:5) {
o_i_8<- operations[[i_8]]
counter<- counter + 1
tenth <- counter %% 10
r<- p10958(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
if (tenth == 0){
answerholder[tenth]<- r
}
if (r == 10958) {
solved<- 1
solution<- c(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
break
}
else {
solved<- 0
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
answerholder
counter<- 0
answerholder<- rep(NA, 3963)
for (i_1 in 1:5) {
o_i_1<- operations[[i_1]]
for (i_2 in 1:5) {
o_i_2<- operations[[i_2]]
for (i_3 in 1:5) {
o_i_3<- operations[[i_3]]
for (i_4 in 1:5) {
o_i_4<- operations[[i_4]]
for (i_5 in 1:5) {
o_i_5<- operations[[i_5]]
for (i_6 in 1:5) {
o_i_6<- operations[[i_6]]
for (i_7 in 1:5) {
o_i_7<- operations[[i_7]]
for (i_8 in 1:5) {
o_i_8<- operations[[i_8]]
counter<- counter + 1
tenth <- counter %% 10
r<- p10958(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
if (tenth == 0) {
answerholder[counter]<- r
}
if (r == 10958) {
solved<- 1
solution<- c(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
break
}
else {
solved<- 0
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
answerholder
hist(answerholder)
? hist
counter<- 0
answerholder<- rep(NA, 3963)
for (i_1 in 1:5) {
o_i_1<- operations[[i_1]]
for (i_2 in 1:5) {
o_i_2<- operations[[i_2]]
for (i_3 in 1:5) {
o_i_3<- operations[[i_3]]
for (i_4 in 1:5) {
o_i_4<- operations[[i_4]]
for (i_5 in 1:5) {
o_i_5<- operations[[i_5]]
for (i_6 in 1:5) {
o_i_6<- operations[[i_6]]
for (i_7 in 1:5) {
o_i_7<- operations[[i_7]]
for (i_8 in 1:5) {
o_i_8<- operations[[i_8]]
counter<- counter + 1
tenth <- counter %% 10
r<- p10958(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
if (tenth == 0) {
answerholder[counter / 10]<- r
}
if (r == 10958) {
solved<- 1
solution<- c(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
break
}
else {
solved<- 0
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
answerholder
answerholder<- rep(NA, 39063)
for (i_1 in 1:5) {
o_i_1<- operations[[i_1]]
for (i_2 in 1:5) {
o_i_2<- operations[[i_2]]
for (i_3 in 1:5) {
o_i_3<- operations[[i_3]]
for (i_4 in 1:5) {
o_i_4<- operations[[i_4]]
for (i_5 in 1:5) {
o_i_5<- operations[[i_5]]
for (i_6 in 1:5) {
o_i_6<- operations[[i_6]]
for (i_7 in 1:5) {
o_i_7<- operations[[i_7]]
for (i_8 in 1:5) {
o_i_8<- operations[[i_8]]
counter<- counter + 1
tenth <- counter %% 10
r<- p10958(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
if (tenth == 0) {
answerholder[counter / 10]<- r
}
if (r == 10958) {
solved<- 1
solution<- c(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
break
}
else {
solved<- 0
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
counter<- 0
answerholder<- rep(NA, 39063)
for (i_1 in 1:5) {
o_i_1<- operations[[i_1]]
for (i_2 in 1:5) {
o_i_2<- operations[[i_2]]
for (i_3 in 1:5) {
o_i_3<- operations[[i_3]]
for (i_4 in 1:5) {
o_i_4<- operations[[i_4]]
for (i_5 in 1:5) {
o_i_5<- operations[[i_5]]
for (i_6 in 1:5) {
o_i_6<- operations[[i_6]]
for (i_7 in 1:5) {
o_i_7<- operations[[i_7]]
for (i_8 in 1:5) {
o_i_8<- operations[[i_8]]
counter<- counter + 1
tenth <- counter %% 10
r<- p10958(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
if (tenth == 0) {
answerholder[counter / 10]<- r
}
if (r == 10958) {
solved<- 1
solution<- c(o_i_1, o_i_2, o_i_3, o_i_4, o_i_5, o_i_6, o_i_7, o_i_8)
break
}
else {
solved<- 0
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
if (solved == 1) {
break
}
}
(12) + (3) / (45) - (6) + (7) * (8) - (9)
hist(answerholder)
view(answerholder)
answerholder
answerholder(100000)
answerholder[100000]
answerholder[39000]
answerholder[39062]
answerholder[39061]
answerholder[39060]
answerholder[39059]
answerholder[29453]
hist(answerholder)
density(answerholder)
answerholder[39062]
answerholder[39063]
answerholder<- answerholder[1:39062]
density(answerholder)
summary(answerholder)
require(Hmisc)
describe(answerholder)
count = rep(1:39062)
plot(count, answerholder)
require(data.table)
ah<- as.data.table(count, answerholder)
View(ah)
ah[, answers := answerholder]
ah<- as.data.table(answerholder)
ah[, index = _n]
ah[, index = n]
ah[, index = count]
ah[, index = rep(1:39062)]
ah[, index := rep(1:39062)]
ah$index
View(ah)
ah2 <- ah[ answerholder < 1000]
y<- rep(length(ah2))
y<- rep(1:length(ah2))
plot[ah2, index]
plot[ah2]
plot[ah2$answerholder, ah2$index]
plot(ah2$answerholder, ah2$index)
library( dplyr )
# NOTES: This script is a modification of code originally written by Open Data for Nonprofit Research / Jesse Lecy.
### (see https://lecy.github.io/Open-Data-for-Nonprofit-Research/). It was originally accessed on August 25th, 2018.
### Its purpose is to create an index of organizations whose IRS990 data we will scrape from XML files made publicly
### available by Amazon Web Services.
# PRELIMINARIES
###install.packages(c("jsonlite", "R.utils", "curl", "dplyr", "xml2" ))
library( jsonlite )
library( R.utils )
library( curl )
library( dplyr )
library( xml2 )
options(timeout= 4000000)
# SET YOUR DIRECTORIES
datdir <- "S:/Dropbox/IRS990Analysis/data"
datout <- paste0(datdir, "/output")
datin <- paste0(datdir, "/input")
# CREATE A DATA FRAME OF ELECTRONIC FILERS FROM IRS JSON FILES
dat1 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2011.json")[[1]]
dat2 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2012.json")[[1]]
dat3 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2013.json")[[1]]
dat4 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2014.json")[[1]]
dat5 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2015.json")[[1]]
dat6 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2016.json")[[1]]
dat7 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2017.json")[[1]]
View(data)
View(dat6)
source('~/Dropbox/IRS990Analysis/R/build_index.R', echo=TRUE)
ls() = rm()
ls()
rm(ls())
rm?
? rm
rm(list = ls())
# NOTES: This script is a modification of code originally written by Open Data for Nonprofit Research / Jesse Lecy.
### (see https://lecy.github.io/Open-Data-for-Nonprofit-Research/). It was originally accessed on August 25th, 2018.
### Its purpose is to create an index of organizations whose IRS990 data we will scrape from XML files made publicly
### available by Amazon Web Services.
# PRELIMINARIES
###install.packages(c("jsonlite", "R.utils", "curl", "dplyr", "xml2" ))
library( jsonlite )
library( R.utils )
library( curl )
library( dplyr )
library( xml2 )
options(timeout= 4000000)
# SET YOUR DIRECTORIES
datdir <- "S:/Dropbox/IRS990Analysis/data"
datout <- paste0(datdir, "/output")
datin <- paste0(datdir, "/input")
# CREATE A DATA FRAME OF ELECTRONIC FILERS FROM IRS JSON FILES
dat1 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2011.json")[[1]]
dat2 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2012.json")[[1]]
dat3 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2013.json")[[1]]
dat4 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2014.json")[[1]]
dat5 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2015.json")[[1]]
dat6 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2016.json")[[1]]
dat7 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2017.json")[[1]]
dat8 <- fromJSON("https://s3.amazonaws.com/irs-form-990/index_2018.json")[[1]]
data <- rbind( dat1, dat2, dat3, dat4, dat5, dat6, dat7, dat8 )
rm(dat1, dat2, dat3, dat4, dat5, dat6, dat7, dat8)
# REFORMAT FILING DATE FROM YYYY-MM TO YYYY
### Tax Period represents the end of the nonprofit's accounting year
### The tax filing year is always the previous year, unless the accounting year ends in December
year <- as.numeric( substr( data$TaxPeriod, 1, 4 ) )
month <- substr( data$TaxPeriod, 5, 6 )
data$FilingYear <- year - 1
data$FilingYear[ month == "12" ] <- year[ month == "12" ]
# SAVE COMPLETE INDEX
setwd(datout)
save(data, file = "CompleteIndex.Rda")
datdir <- "/Users/julianduggan/Dropbox/IRS990Analysis/data"
datout <- paste0(datdir, "/output")
datin <- paste0(datdir, "/input")
setwd(datout)
save(data, file = "CompleteIndex.Rda")
setwd(datout)
load(file = "CompleteIndex.Rda")
View(data)
ttanks_name = read.csv("mcgann_rank.csv")
setwd(datin)
ttanks_name = read.csv("mcgann_rank.csv")
View(ttanks_name)
ttanks_index = data[data$EIN %in% ttanks_name$EIN,]
View(ttanks_index)
summary(ttanks_index$year)
summary(ttanks_index$FilingYear)
describe(ttanks_index$FilingYear)
tabulate(ttanks_index$FilingYear)
table(ttanks_index$FilingYear)
