r:social_network_analysis
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
r:social_network_analysis [2023/06/12 03:08] – [Hawthorne study] hkimscil | r:social_network_analysis [2024/11/14 09:02] (current) – [Hawthorne study] hkimscil | ||
---|---|---|---|
Line 8: | Line 8: | ||
{{: | {{: | ||
< | < | ||
- | library(tidiverse) | + | # install.packages(c(" |
+ | library(igraph) | ||
+ | library(tidyverse) | ||
sd <- read.csv(" | sd <- read.csv(" | ||
head(sd) | head(sd) | ||
Line 27: | Line 30: | ||
< | < | ||
+ | V(g)$type <- bipartite_mapping(g)$type | ||
types <- V(g)$type | types <- V(g)$type | ||
deg <- degree(g) | deg <- degree(g) | ||
Line 178: | Line 182: | ||
> | > | ||
</ | </ | ||
+ | ===== stu x class 처럼 분석한 예 ===== | ||
< | < | ||
actor_matrix <- bipartite_matrix %*% t(bipartite_matrix) | actor_matrix <- bipartite_matrix %*% t(bipartite_matrix) | ||
event_matrix <- t(bipartite_matrix) %*% bipartite_matrix | event_matrix <- t(bipartite_matrix) %*% bipartite_matrix | ||
+ | |||
diag(actor_matrix) <- 0 | diag(actor_matrix) <- 0 | ||
actor_matrix | actor_matrix | ||
+ | actor_matrix_cff_2 <- ifelse(actor_matrix > 2, actor_matrix, | ||
+ | actor_matrix_cff_3 <- ifelse(actor_matrix > 3, actor_matrix, | ||
actor_g <- graph_from_adjacency_matrix(actor_matrix, | actor_g <- graph_from_adjacency_matrix(actor_matrix, | ||
mode = " | mode = " | ||
| | ||
+ | |||
+ | actor_g_cff_2 <- graph_from_adjacency_matrix(actor_matrix_cff_2, | ||
+ | mode = " | ||
+ | | ||
+ | actor_g_cff_3 <- graph_from_adjacency_matrix(actor_matrix_cff_3, | ||
+ | mode = " | ||
+ | | ||
+ | |||
+ | V(actor_g)$size <- betweenness(actor_g) | ||
+ | V(actor_g_cff_2)$size <- betweenness(actor_g_cff_2) | ||
+ | V(actor_g_cff_3)$size <- betweenness(actor_g_cff_3) | ||
+ | V(actor_g)$label.cex <- betweenness(actor_g) * 0.2 | ||
+ | V(actor_g_cff_2)$label.cex <- betweenness(actor_g_cff_2) * 0.1 | ||
+ | V(actor_g_cff_3)$label.cex <- betweenness(actor_g_cff_3) * 0.4 | ||
+ | |||
actor_g | actor_g | ||
+ | actor_g_cff_2 | ||
+ | actor_g_cff_3 | ||
event_g <- graph_from_adjacency_matrix(event_matrix, | event_g <- graph_from_adjacency_matrix(event_matrix, | ||
Line 195: | Line 220: | ||
| | ||
event_g | event_g | ||
- | |||
- | # V(actor_g)$size <- degree(actor_g) | ||
- | V(actor_g)$label.cex <- actor_g * 0.1 | ||
- | |||
windowsFonts(d2coding = windowsFont(" | windowsFonts(d2coding = windowsFont(" | ||
windowsFonts(lucida = windowsFont(" | windowsFonts(lucida = windowsFont(" | ||
- | windowsFonts(courrier = windowsFont(" | ||
shape <- c(" | shape <- c(" | ||
fnts <- c(" | fnts <- c(" | ||
- | plot(actor_g, | + | plot(actor_g, |
| | ||
- | | + | |
- | ) | + | |
+ | ) | ||
+ | plot(actor_g_cff_2, | ||
+ | | ||
+ | | ||
+ | | ||
+ | ) | ||
+ | plot(actor_g_cff_3, | ||
+ | | ||
+ | | ||
+ | | ||
+ | ) | ||
</ | </ | ||
- | {{: | + | |
+ | [{{: | ||
+ | [{{: | ||
+ | [{{: | ||
+ | |||
+ | |||
+ | ===== 다른 방법 ===== | ||
< | < |
r/social_network_analysis.1686506934.txt.gz · Last modified: 2023/06/12 03:08 by hkimscil