forked from laser-institute/network-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJustina Lab 1 Script.R
27 lines (22 loc) · 898 Bytes
/
Justina Lab 1 Script.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
library(tidyverse) #make sure to add the libraries first and dont write the code for install in the script
library(tidygraph)
library(ggraph)
library(readxl)
student_nodes <- read_excel("lab-1/data/student-attributes.xlsx")
student_edges <- read_excel("lab-1/data/student-edgelist.xlsx")
student_network <- tbl_graph(edges = student_edges,
nodes = student_nodes,
directed = TRUE)
student_network
plot(student_network)
autograph(student_network)
ggraph(student_network, layout = "stress") +
geom_edge_link(arrow = arrow(length = unit(1, 'mm')),
end_cap = circle(3, 'mm'),
start_cap = circle(3, 'mm'),
alpha = .1) +
geom_node_point(aes(size = local_size(),
color = gender)) +
geom_node_text(aes(label = id),
repel=TRUE) +
theme_graph()