View source: R/narrative_centrality.R
narrative_centrality | R Documentation |
This function calculates the dynamic centrality scores of characters on directed interaction data using the measure defined in Jones, Quinn and Koskinen (2020).
narrative_centrality(
event_list,
char_names = NULL,
mode = "both",
wp = 0.01,
normalised = TRUE,
from = 1
)
event_list |
An event list containing the time-ordered interactions. The function expects a particular format wherein the first column contains the ID of the sender ID (for dialogue data, this is the speaker) and each column C represents a dummy variable for character C-1 which takes the value of 1 if character C-1 is a recipient of the interaction (for dialogue data, this means being spoken to) at time t and 0 otherwise. For example, column 2 contains the dummy variables for the character whose ID is 1, and so on. |
char_names |
An optional vector of character names to be used to label the scores matrix returned by the function (must be of equal length to the number of unique characters in the event list). If not supplied, names will be inferred from the event list. |
mode |
This argument specifies whether to return the speaking scores ("out"), spoken-to scores ("in"), or both ("both"). In the case of “both”, a named list is returned containing first the “out” matrix and then the “in” matrix. For either “out” or “in”, a single matrix is returned. The default option is "both". |
wp |
A value to be used for the weighting parameter lambda in the calculation of scores (see Jones, Quinn and Koskinen 2020). The default value is 0.01. |
normalised |
Logical. When |
from |
The position of the column in the input data (as structured in the way described above) containing the sender IDs. This ensures the function always works the same way, even when the input event list contains different numbers of additional event-level variables (e.g. weight or type), so long as these columns are positioned prior to the sender ID column. The default is 1. |
If mode = "out"
or mode = "in"
, an N-by-T matrix is
returned, where N is the total number of characters in the event list and T
is the total number of interactions in the event list. Each cell [n, t] in
this matrix represents the score of character n at time t. If mode =
"both"
, a named list of length 2 is returned containing first the "out"
matrix and second the "in" matrix.
Jones, Pete, Eithne Quinn and Johan Koskinen. 2020. "Measuring centrality in film narratives using dynamic character interaction networks." Social Networks 63: 21-37. DOI: https://doi.org/10.1016/j.socnet.2020.03.003.
tfa <- movienetdata::starwars_tfa
tfa_scores <- narrative_centrality(tfa$event_list,
char_names = tfa[[2]]$char_name,
wp = 0.01,
from = 3)
# What is the (normalised) speaking score of character 5 at time t=50?
tfa_scores$out_scores[5, 50]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.