Learn R Programming

timeordered (version 0.9.6)

randomizeidentities: Resamples data based on vertex identity.

Description

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.

Usage

randomizeidentities(raw, withinvertexfrom, byvertexfrom, withreplacement)

Arguments

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.

Value

  • 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.

See Also

randomizetimes,rarefy

Examples

Run this code
data(ants)
allindivs <- c(union(ants$VertexFrom, ants$VertexTo), "NULL1", "NULL2")
ri <- randomizeidentities(ants,withinvertexfrom=TRUE,byvertexfrom=TRUE,withreplacement=TRUE)
g <- generatetonetwork(ri, allindivs)
plottonet(g)

Run the code above in your browser using DataLab