How do I meaningfully map task_difficulty
, an integer 1,2,3,4,5
, to the nodes, with e.g. size
, given that each person
, performing the task is not a task
Elaboration follows here:
I have this example network, where:
- Names are persons
v, w, x, y, z
are tasksA, B, C
are roles relative to the task
Created using this example code:
# Load libraries ----------------------------------------------------------
library("tidyverse")
library("ggraph")
library("tidygraph")
# Define example data -----------------------------------------------------
set.seed(651906)
n <- 30
my_data <- tibble(
person = sample(c("Georgina",
"Jeanice",
"Emmitt",
"Agripina",
"Gregg"),
size = n,
replace = TRUE),
task = sample(letters[22:26],
size = n,
replace = TRUE),
role = sample(LETTERS[1:3],
size = n,
replace = TRUE),
task_difficulty = sample(seq(1,5),
size = n,
replace = TRUE))
# Wrangle data ------------------------------------------------------------
my_data_graph <- my_data %>%
as_tbl_graph
# Create graph ------------------------------------------------------------
my_data_graph %>%
ggraph(layout = "kk") +
geom_edge_link(aes(edge_colour = role)) +
geom_node_point() +
geom_node_text(aes(label = name),
repel = TRUE) +
theme_graph()
I.e. the example data looks like so:
> my_data
# A tibble: 30 x 4
person task role task_difficulty
<chr> <chr> <chr> <int>
1 Georgina x C 3
2 Emmitt x C 4
3 Gregg z C 5
4 Jeanice z B 3
5 Agripina v B 1
6 Emmitt w C 2
7 Jeanice w B 5
8 Georgina w B 3
9 Emmitt x B 4
10 Jeanice w B 1
# … with 20 more rows