mesh_assoc_table: Builds an association matrix for all MeSH terms in an article...

Description Usage Arguments Value Examples

View source: R/rpubmed_mesh.R

Description

Builds an association matrix for all MeSH terms in an article corpus

Usage

1

Arguments

corpus

a list of Pubmed records. e.g. as returned by fetch_in_chunks()

Value

matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 

articles <- fromJSON("Test/PCD_articles.json")
diab = get_articles_by_terms(articles, list("diabetes", c("case-control")), where= in_mesh_abstract_p)
diab_assoc <- mesh_assoc_table(diab)
# list of MeSH headings with frequencies:
d <- diag(diab_assoc)

Pick only those appearing in > 5 articles:
d_5 <- d[d > 5]
# Reduce assoc table to those with > 5 articles:
diab_5 <- diab_assoc[names(d_5), names(d_5)]

# Graph the results:
require(igraph)
g <- graph.adjacency(diab_5, mode = "upper", weighted = TRUE)
g <- simplify(g)
V(g)$label <- V(g)$name
V(g)$degree <- degree(g)
layout1 <- layout.fruchterman.reingold(g)
V(g)$label.cex <- V(g)$degree / max(V(g)$degree)
plot(g, layout=layout1)

## End(Not run)

rpubmed documentation built on May 2, 2019, 5:25 p.m.