multicast_to_dyadic: Convert a multicast event list to dyadic format

View source: R/helpers.R

multicast_to_dyadicR Documentation

Convert a multicast event list to dyadic format

Description

Convert a time-ordered multicast event list into a dyadic from-to format, preserving other event-level variables.

Usage

multicast_to_dyadic(event_list, from = 3, force_seq = FALSE)

Arguments

event_list

A multicast event list containing a column of sender IDs followed immediately by dummy variables for each character.

from

The column containing the sender IDs.

force_seq

Logical. If TRUE, events with multiple recipients will be forced into a false sequence, and each row in the dyadic event list will increment the event ID variable. If FALSE, multicast events will be split into the dyadic components, but the event ID variable will indicate that these dyadic events are simultaneous.

Value

A time-ordered dyadic event list (as a matrix).

Examples

tfa <- movienetdata::starwars_tfa
# Convert The Force Awakens event list to dyadic format
tfa_dyads <- multicast_to_dyadic(tfa$event_list,
                                 from = 3)
# And convert it back to multicast format
tfa_events <- dyadic_to_multicast(event_list = tfa_dyads,
                                  from = 4,
                                  to = 5,
                                  time_col = 1,
                                  char_names = tfa$node_list$char_name)


pj398/charinet documentation built on May 2, 2024, 10:28 p.m.