# NSERC – Discovery Grants Program, over the past 5 years

**R-english – Freakonometrics**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In a previous post, I discussed how it was possible to scrap the NSERC website to get stats about discovery grants. Since we just got the new 2018 figures, I thought it would be a good opportunity to update my graphs,

library(XML) library(stringr) url="http://www.nserc-crsng.gc.ca/NSERC-CRSNG/FundingDecisions-DecisionsFinancement/ResearchGrants-SubventionsDeRecherche/ResultsGSC-ResultatsCSS_eng.asp" download.file(url,destfile = "GSC.html") library(XML) tables=readHTMLTable("GSC.html") GSC=tables[[1]]$V1 GSC=as.character(GSC[-(1:2)]) namesGSC=tables[[1]]$V2 namesGSC=as.character(namesGSC[-(1:2)]) Correction = function(x) as.numeric(gsub('[$,]', '', x)) YEAR=2013:2018 for(i in 1:length(YEAR)){ y=YEAR[i] grants= function(gsc){ url=paste("http://www.nserc-crsng.gc.ca/NSERC-CRSNG/FundingDecisions-DecisionsFinancement/ResearchGrants-SubventionsDeRecherche/ResultsGSCDetail-ResultatsCSSDetails_eng.asp?Year=",y,"&GSC=",gsc,sep="") download.file(url,destfile = "GSC.html") library(XML) tables=readHTMLTable("GSC.html") X=as.character(tables[[1]]$"Awarded Amount") A=as.numeric(Vectorize(Correction)(X)) return(c(median(A),mean(A),as.numeric(quantile(A,(1:99)/100)))) } M=Vectorize(grants)(GSC[1:12]) plot(M[3:101,8],(1:99)/100,type="s",xlim=c(0,130000),xlab= paste("Annual Discovery Grant (CAN) - ",y,sep=""),ylab="") lines(M[3:101,5],(1:99)/100,type="s",col="red") lines(M[3:101,4],(1:99)/100,type="s",col="blue") abline(v=M[3,5],lty=2,col=rgb(1,0,0,.4)) idx=which(M[3:101,8]With those functions, I plot the cumulative distribution functions for three disciplines, manely

maths,physicsandchemistry. I added a line for the lowest value in physics (the vertical line), and the bold line shows the proportion of researchers in maths who gotlessthan the lowest amount in physics,Hence, in 2013, 60% of the researchers in maths get less than any researcher in physics (and more than 90% in maths get less than

anyresearcher in chemistry). Then, from 2014 to 2018, we getIt is rather constant : 50% of the researchers in mathematics in Canada get less than any researcher in physics, or in chemistry. I don’t understand why, but it’s interesting to observe that this is very stable…

Toleave a commentfor the author, please follow the link and comment on their blog:R-english – Freakonometrics.

R-bloggers.com offersdaily e-mail updatesabout R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.