Created
May 15, 2012 22:44
-
-
Save bobthecat/2705715 to your computer and use it in GitHub Desktop.
pubmed trend for pain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source('pubmed_trend.r') | |
sex.pub <- pubmed_trend(search.str = 'Sex+Characteristics[mh] AND Pain[mh]', year.span=1970:2011) | |
analgesic.pub <- pubmed_trend(search.str = 'Sex+Characteristics[mh] AND Analgesics[mh]', year.span=1970:2011) | |
source('plot_bar.r') | |
library("RColorBrewer") | |
pdf(file='sex_pain.pdf', height=8, width=8) | |
par(las=1) | |
colorfunction = colorRampPalette(brewer.pal(9, "Reds")) | |
mycolors = colorfunction(length(sex.pub)) | |
plot_bar(x=sex.pub, linecol="#525252", cols=mycolors, addArg=FALSE) | |
colorfunction = colorRampPalette(brewer.pal(9, "Blues")) | |
mycolors = colorfunction(length(analgesic.pub)) | |
plot_bar(x=analgesic.pub, linecol='black', cols=mycolors, addArg=TRUE) | |
title('Number of publication per year') | |
legend('topleft', | |
legend=c('Sex and Pain', 'Sex and Analgesics'), | |
fill=c("red", "blue"), | |
bty="n", | |
cex=1.1 | |
) | |
dev.off() |
thx dude,
I read it here http://www.r-bloggers.com/using-r-to-graph-a-subject-trend-in-pubmed/
and it took me some time to explore these steps
:)
great work btw!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks produnis,
This Gist is part of a blog post available here. http://brainchronicle.blogspot.com/2012/05/using-r-to-graph-subject-trend-in.html