actors <- data.frame(
actor = 1:5, label = paste("Actor", 1:5),
present = TRUE, gender = sample.int(2, 5, replace = TRUE)
)
actors <- defineNodes(nodes = actors)
callNetwork <- defineNetwork(nodes = actors)
# Link events to a nodeset
compositionChangeEvents <- data.frame(
time = c(14, 60),
node = "Actor 4",
replace = c(FALSE, TRUE)
)
actorsnew <- linkEvents(
x = actors, attribute = "present", changeEvents = compositionChangeEvents
)
# Link events to a Network
calls <- data.frame(
time = c(12, 27, 45, 56, 66, 68, 87),
sender = paste("Actor", c(1, 3, 5, 2, 3, 4, 2)),
receiver = paste("Actor", c(4, 2, 3, 5, 1, 2, 5)),
increment = rep(1, 7)
)
callNetwork <- linkEvents(
x = callNetwork, changeEvent = calls, nodes = actors
)
Run the code above in your browser using DataLab