Package 'diskurs'

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: 2024-09-06 14:18:41 UTC
Source: https://github.com/urban-sustainability-lab-zurich/diskurs

Help Index


Aggregate discourse graph

Description

Aggregate discourse graph

Usage

aggregate_discourse_graph(disc_g, keep_only_highest = FALSE)

Arguments

disc_g

The discourse graph to aggregate

keep_only_highest

Should only the most prevalent category of edges per actor-statement pair be kept?

Value

An object of type discourse_graph with property aggregated set to TRUE


Explode discourse graph (make statement nodes qualified)

Description

This function "explodes" a discourse graph, making all statement nodes into qualified nodes.

Usage

explode_graph(disc_g, stance_subset = SUPPORTED_STANCE_CLASSES)

Arguments

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

Description

Extract igraph object from discourse graph

Arguments

g

The discourse graph to extract igraph object from

Value

An object of class igraph


Get incidence matrix of discourse graph

Description

Get incidence matrix of discourse graph

Usage

get_incmat(disc_g, make_binary = FALSE)

Arguments

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

Description

Extract tidygraph object from discourse graph

Arguments

g

The discourse graph to extract tidygraph object from

Value

An object of class tidygraph


Check if object is of type discourse_graph

Description

Check if object is of type discourse_graph

Usage

is.discourse_graph(object)

Arguments

object

The object to evaluate

Value

boolean

Examples

is.discourse_graph(diskurs::discourse_graph_example)

Load discourse graph from nodelist of actors/ statements and edgelist of expressed stances

Description

Load discourse graph from nodelist of actors/ statements and edgelist of expressed stances

Usage

load_discourse_graph(nodelist, edgelist)

Arguments

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

Value

A discourse graph object

Examples

diskurs::load_discourse_graph(diskurs::nodelist_example,diskurs::edgelist_example)

Plot discourse graph

Description

Plot discourse graph

Arguments

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

Description

Remove isolates from discourse graph object

Usage

remove_isolates(disc_g)

Arguments

disc_g

A discourse graph object

Value

A discourse graph object with isolated nodes (actors with no expressed stances or statements with no refering stances) removed


Time-slice graph

Description

Time-slice graph

Usage

time_slice_graph(disc_g, start_date, end_date)

Arguments

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

Value

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

Description

Create a list of time-sliced graphs

Usage

time_sliced_graph_list(
  disc_g,
  time_window,
  date_range,
  step_interval = "month",
  aggregate = FALSE,
  remove_isolates = FALSE,
  keep_only_highest = FALSE
)

Arguments

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.