-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamenable_bib.R
85 lines (66 loc) · 2.31 KB
/
amenable_bib.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
## pubmed search for amenable mortality
library(RISmed)
library(tidyverse)
library(tidytext)
library(wordcloud)
search <- "amenable mortality"
s <- EUtilsSummary(search,
type = "esearch",
db = "pubmed",
datetype = "pdat",
retmax = 12000,
mindate = 2005,
maxdate = 2016)
fetch <- EUtilsGet(s, type = "efetch", db = "pubmed")
abstracts <- data.frame(title = fetch@ArticleTitle,
abstract = fetch@AbstractText,
journal = fetch@Title,
DOI = fetch@PMID,
year = fetch@YearPubmed) %>%
mutate(abstract = as.character(abstract))
abstracts %>%
group_by(year) %>%
tally() %>%
ggplot(aes(year, n)) +
geom_col(fill = "blue") +
labs(title = paste0("Articles on ", search))
s@count
## there are 21 direct articles
am_abs <- abstracts %>%
filter(stringr::str_detect(title, "[Aa]menable [Mm]ortality"))
am_abs$abstract <- tm::removeNumbers(am_abs$abstract)
am_cloud <- am_abs %>%
unnest_tokens(ngram, abstract, token = "ngrams", n=2) %>%
count(ngram, sort = TRUE) %>%
separate(ngram, c("word1", "word2"), sep = " ") %>%
filter(!word1 %in% stop_words$word) %>%
filter(!word2 %in% stop_words$word) %>%
mutate(bigram = paste(word1, word2, sep = " ") )
am_cloud %>%
with(wordcloud(bigram, n, min.freq = 3, max.words = 1000, colors = brewer.pal(8, "Dark2")), scale = c(8,.3), per.rot = 0.4)
am_abs %>%
DT::datatable()
## GBD search
search1 <- "Global+Burden+of+Disease|GBD"
s1 <- EUtilsSummary(search1,
type = "esearch",
db = "pubmed",
datetype = "pdat",
retmax = 12000,
mindate = 2010,
maxdate = 2016)
fetch <- EUtilsGet(s1, type = "efetch", db = "pubmed")
abstracts <- data.frame(title = fetch@ArticleTitle,
abstract = fetch@AbstractText,
journal = fetch@Title,
DOI = fetch@PMID,
year = fetch@YearPubmed) %>%
mutate(abstract = as.character(abstract))
abstracts %>%
group_by(year) %>%
tally() %>%
ggplot(aes(year, n)) +
geom_col(fill = "blue") +
labs(title = paste0("Articles on ", search1))
s1@count
s1@querytranslation