View source: R/duration.matrix.R
duration.matrix | R Documentation |
Given a network object and a toggle list, it will construct a list of edges and activity spells and return that as a data frame. The network object does not need to have edges; it only needs to have enough vertices to cover all the edges specified in the toggle list.
The toggle list should be a three column matrix or data frame, where the first column is the toggle time, the second column is the tail vertex id of the edge, and the third column is the head vertex id of the edge. A toggle represents a switch from active state to inactive, or vice-versa.
duration.matrix(nw0, changes, start, end)
nw0 |
an object of class |
changes |
a matrix or data frame, listing the toggles for edges as specified in the above description |
start |
integer, specifies the starting time of the network's dynamic activity |
end |
integer, specifies the ending time of the network's dynamic activity |
Returns a data frame that lists the edge spells specified by the toggles. The columns in the data frame are
start end tail head left.censored right.censored duration
. Left and right censoring and duration are calculated
automatically from the toggle list and the start and end times.
Ayn Leslie-Cook aynlc3@uw.edu, Carter T. Butts buttsc@uci.edu
as.networkDynamic
library(networkDynamic)
# duration matrix test
net <-network.initialize(3)
net[1,2]<-1;
net[2,3]<-1;
net[1,3]<-1;
class(net)
# toggle list: time, tail, head
tog=matrix(c(1,1,2, 1,2,3, 2,1,2, 4,1,3, 4,1,2), ncol=3, byrow=TRUE)
networkDynamic:::duration.matrix(net, tog, 0, 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.