randomizeidentities: Resamples data based on vertex identity.

View source: R/randomizeidentities.R

randomizeidentitiesR Documentation

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.

Author(s)

Benjamin Blonder bblonder@email.arizona.edu.

See Also

randomizetimes,rarefy

Examples

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)


timeordered documentation built on Aug. 21, 2023, 1:06 a.m.