View source: R/randomizeidentities.R
randomizeidentities | R Documentation |
Produces a new event list from an existing event list with resampled vertex identities given certain constraints on randomization. Effectively re-orders pairs of From/To vertices between different times.
randomizeidentities(raw, withinvertexfrom, byvertexfrom, withreplacement)
raw |
A raw event list to be resampled. Contains four columns: VertexFrom, VertexTo, TimeStart, TimeStop |
withinvertexfrom |
If true, resamples within data subsets where VertexFrom is fixed; otherwise resamples within all data. |
byvertexfrom |
If true, subsets of data for withinvertexfrom are obtained using VertexFrom; if false, using VertexTo. |
withreplacement |
Samples with or without replacement. |
An event list of the same size or smaller as raw. The returned event list will be smaller only if resampling produces events that connect a vertex to itself; these are removed.
Benjamin Blonder bblonder@email.arizona.edu.
randomizetimes
,rarefy
data(ants)
allindivs <- c(union(as.character(ants$VertexFrom), as.character(ants$VertexTo)), "NULL1", "NULL2")
ri <- randomizeidentities(ants,withinvertexfrom=TRUE,byvertexfrom=TRUE,withreplacement=TRUE)
g <- generatetonetwork(ri, allindivs)
plottonet(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.