-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript_dna_020-affiliation-networks.R
executable file
·70 lines (57 loc) · 2.07 KB
/
script_dna_020-affiliation-networks.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
source("script_dna_010-workspace.R")
concepts_2002 <- dna_barplot(conn,
of = "concept", fontSize = 10,
stop.date = "01.01.2003")
concepts_2003 <- dna_barplot(conn,
of = "concept", fontSize = 10,
start.date = "01.01.2003")
pdf(file = "fig_barplot_concepts_2002.pdf",
width = 5,
height = 6)
concepts_2002
dev.off()
pdf(file = "fig_barplot_concepts_2003.pdf",
width = 5,
height = 6)
concepts_2003
dev.off()
set.seed(19030023)
selection_person <- person %>% filter(frequency >9)
selection_person$value
exclusion_person <- person %>% filter(frequency < 10)
selection_concept <- c(1, 11, 12, 13)
concept$value[selection_concept]
exclusion_concept <- concept$value[-selection_concept]
# Affiliation network
## person x concept, substract-method and normalization, including duplicates
affil <- dna_network(conn,
networkType = "twomode",
statementType = "DNA Statement",
variable1 = "person",
variable2 = "concept",
qualifier = "agreement",
qualifierAggregation = "subtract",
normalization = "prominence",
duplicates = "document",
verbose = TRUE,
excludeValues = list(person = exclusion_person$value,
concept = exclusion_concept))
x <- t(affil)
y <- selection_person %>% filter(value %in% colnames(x))
nw <- network(affil, bipartite = TRUE)
colors <- as.character(t(affil))
colors <- colors[colors != "0"]
colors[colors < 0] <- "gray85"
colors[colors != "gray85"] <- "black"
set.edge.attribute(nw, "color", colors)
pdf(file = "fig_network_affiliation.pdf",
width = 8,
height = 8)
plot(nw,
edge.col = get.edge.attribute(nw, "color"),
vertex.col = c(y$color,
rep("white", ncol(affil))),
displaylabels = TRUE,
label.cex = 0.5,
)
dev.off()