nodes_from_events: Extract a nodelist from an event list

View source: R/helpers.R

nodes_from_eventsR Documentation

Extract a nodelist from an event list

Description

A helper function for extracting a simple list of nodes based on the interactions in an event list. Extracts the character ID numbers, character names, and the number of lines spoken by each character.

The event list should be structured consistently with the format specified elsewhere in this package documentation (at least a sender ID column followed by columns containing binary dummy variables for each character).

Usage

nodes_from_events(event_list, from = 3, receivers = FALSE)

Arguments

event_list

The event list, containing at least a sender ID column and columns containing binary dummy variables for each character.

from

The column containing the sender IDs, followed by dummy variables for each character.

receivers

If TRUE, a column linesin will be added to the nodelist containing the number of times the node was the recipient of a line of dialogue. Only makes sense when dummy variables for recipients correspond to direct interaction data (but not when the dummies correspond to co-occurence or proximity, as with automatic extraction methods).

Value

A data frame with rows corrsponding to characters and columns containing node-level variables.

Examples

tfa_events <- movienetdata::starwars_tfa$event_list
tfa_nodes <- nodes_from_events(event_list = tfa_events,
                               from = 3,
                               receivers = TRUE)


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