Title: | An R Package To Handle Discourse Network Data |
---|---|
Description: | An R package to handle discourse network data as a bipartite graph of actor nodes, qualified stance edges and statement (belief) nodes. |
Authors: | Mario Angst [aut, cre] |
Maintainer: | Mario Angst <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.3 |
Built: | 2025-03-05 06:03:57 UTC |
Source: | https://github.com/urban-sustainability-lab-zurich/diskurs |
Aggregate discourse graph
aggregate_discourse_graph(disc_g, keep_only_highest = FALSE)
aggregate_discourse_graph(disc_g, keep_only_highest = FALSE)
disc_g |
The discourse graph to aggregate |
keep_only_highest |
Should only the most prevalent category of edges per actor-statement pair be kept? |
An object of type discourse_graph with property aggregated set to TRUE
This function "explodes" a discourse graph, making all statement nodes into qualified nodes.
explode_graph(disc_g, stance_subset = SUPPORTED_STANCE_CLASSES)
explode_graph(disc_g, stance_subset = SUPPORTED_STANCE_CLASSES)
disc_g |
A discourse graph object |
stance_subset |
Character vector of stance classes. Restrict explosion to a specific set of stance classes only? Defaults to all supported. |
Extract igraph object from discourse graph
g |
The discourse graph to extract igraph object from |
An object of class igraph
Get incidence matrix of discourse graph
get_incmat(disc_g, make_binary = FALSE)
get_incmat(disc_g, make_binary = FALSE)
disc_g |
A discourse graph object |
make_binary |
Logical. Dichotomize/ make binary? Defaults to FALSE, which returns a valued matrix with the number of stances in entries. |
Extract tidygraph object from discourse graph
g |
The discourse graph to extract tidygraph object from |
An object of class tidygraph
Check if object is of type discourse_graph
is.discourse_graph(object)
is.discourse_graph(object)
object |
The object to evaluate |
boolean
is.discourse_graph(diskurs::discourse_graph_example)
is.discourse_graph(diskurs::discourse_graph_example)
Load discourse graph from nodelist of actors/ statements and edgelist of expressed stances
load_discourse_graph(nodelist, edgelist)
load_discourse_graph(nodelist, edgelist)
nodelist |
A data frame containing the following columns: nodeid: integer vector of unique node identifiers name: a unique name assigned to a node label: the label of the node mode: one of 'actor' or 'statement' |
edgelist |
An edgelist specifying qualified relations between actors and statements. Takes the form of a data frame containing the following columns: from: actor node ids expressing stances to: statement node ids toward which statements are expressed stance: One of 'support', 'opposition' or 'irrelevant', capturing the qualifier for the stance expression timestamp: A timestamp given the time the stance was expressed |
A discourse graph object
diskurs::load_discourse_graph(diskurs::nodelist_example,diskurs::edgelist_example)
diskurs::load_discourse_graph(diskurs::nodelist_example,diskurs::edgelist_example)
Plot discourse graph
disc_g |
A discourse graph object |
layout_choice |
Layout choice to pass to ggraph. Defaults to "kk" |
label_nodes |
Logical: should nodes be labelled? Defaults to TRUE |
edge_alpha |
Transparency of edges. Defaults to 1 |
arrow_start_cap |
Space from arrow start cap. Defaults to 6. |
arrow_end_cap |
Space from end of arrow. Defaults to 10. |
Remove isolates from discourse graph object
remove_isolates(disc_g)
remove_isolates(disc_g)
disc_g |
A discourse graph object |
A discourse graph object with isolated nodes (actors with no expressed stances or statements with no refering stances) removed
Time-slice graph
time_slice_graph(disc_g, start_date, end_date)
time_slice_graph(disc_g, start_date, end_date)
disc_g |
Discourse graph object |
start_date |
The beginning of the time slice in a format convertible by lubridate::as_date |
end_date |
The end of the time slice in a format convertible by lubridate::as_date |
A discourse graph object subset to include only edges within the time slice given by start_date and end_date
Create a list of time-sliced graphs
time_sliced_graph_list( disc_g, time_window, date_range, step_interval = "month", aggregate = FALSE, remove_isolates = FALSE, keep_only_highest = FALSE )
time_sliced_graph_list( disc_g, time_window, date_range, step_interval = "month", aggregate = FALSE, remove_isolates = FALSE, keep_only_highest = FALSE )
disc_g |
A discourse graph object |
time_window |
The slice window as a time period object, eg. created with months(48) |
date_range |
Character vector of length 2 with a start and end date coercible to date by lubridate::as_date() |
step_interval |
The step interval for time slices. Defaults to "month". |
aggregate |
Logical. Aggregate the time sliced graphs? Defaults to FALSE. |
remove_isolates |
Logical. Remove isolates per time slices? Defaults to FALSE. |
keep_only_highest |
Logical. If aggregate is TRUE, keep only most prevalent stance category per time slice? Defaults to FALSE. |