c.diffnet: Combine diffnet objects

View source: R/diffnet-c.R

c.diffnetR Documentation

Combine diffnet objects

Description

Combining diffnet objects that share time periods and attributes names, but vertices ids (only valid for diffnet objects that have an empty intersection between vertices ids).

Usage

## S3 method for class 'diffnet'
c(..., recursive = FALSE)

Arguments

...

diffnet objects to be concatenated.

recursive

Ignored.

Details

The diffnet objects in ... must fulfill the following conditions:

  1. Have the same time range,

  2. have the same vertex attributes, and

  3. have an empty intersection of vertices ids,

The meta data regarding undirected, value, and multiple are set to TRUE if any of the concatenating diffnet objects has that meta equal to TRUE.

The resulting diffnet object's columns in the vertex attributes ordering (both dynamic and static) will coincide with the first diffnet's ordering.

Value

A new diffnet object with as many vertices as the sum of each concatenated diffnet objects' number of vertices.

See Also

Other diffnet methods: %*%(), as.array.diffnet(), diffnet-arithmetic, diffnet-class, diffnet_index, plot.diffnet(), summary.diffnet()

Examples

# Calculate structural equivalence exposure by city -------------------------
data(medInnovationsDiffNet)

# Subsetting diffnets
city1 <- medInnovationsDiffNet[medInnovationsDiffNet[["city"]] == 1]
city2 <- medInnovationsDiffNet[medInnovationsDiffNet[["city"]] == 2]
city3 <- medInnovationsDiffNet[medInnovationsDiffNet[["city"]] == 3]
city4 <- medInnovationsDiffNet[medInnovationsDiffNet[["city"]] == 4]

# Computing exposure in each one
city1[["expo_se"]] <- exposure(city1, alt.graph="se", valued=TRUE)
city2[["expo_se"]] <- exposure(city2, alt.graph="se", valued=TRUE)
city3[["expo_se"]] <- exposure(city3, alt.graph="se", valued=TRUE)
city4[["expo_se"]] <- exposure(city4, alt.graph="se", valued=TRUE)

# Concatenating all
diffnet <- c(city1, city2, city3, city4)
diffnet



netdiffuseR documentation built on Aug. 30, 2023, 5:07 p.m.