windowed.adjacency: Calculate adjacency of units within moving windows

Description Usage Arguments Value

Description

Calculate the adjacency (or coincidence) of units within moving windows over the order in which they occur. For instance, the adjacency of words in a given word distance or actors within converstations in a given distance of messages. Additionally, the context in which the units occured can be given. For instance, the documents in which words occur or the converstations in which messages occur. Optionally, the order of units can also be used to indicate the direction in which units co-occur. For instance, only counting how often an actor responded to another actor in a conversation.

Usage

1
2
windowed.adjacency(unit.vars, order, context = NULL, window.size = 2,
  count.once = F, direction = "undirected", as.graph = FALSE)

Arguments

unit.vars

Vectors representing the units. Can be a single vector or multiple vectors (as a data.frame or list). Units are then defined as unique combinations of vectors (e.g., first and last name of a person)

order

A numerical vector indicating the order in which units occured (within each context)

context

A vector representing the context in which the units occured.

window.size

A numerical scalar indicating the size of the moving window. The default (and minimum) is 2, which means that only units directly next to each other are counted.

count.double

Logical. If TRUE, multiple occurence of the same unit within a window are summed. If FALSE, units are only counted once.

direction

A character string. If 'undirected', the co-occurence of units in windows is counted. If 'up', it is counted how often a unit occured after other units in windows. if 'down', it is counted how often a unit occured before other units (simply the inverse of 'up')

as.graph

Logical. If TRUE, the output is returned as a graph. Otherwise output is a list containing the adjacency matrix and vectors representing its rows/columns

Value

Either a list containing a (sparse) matrix and vector representing rows/columns, or a graph (if as.graph == T)


kasperwelbers/network-tools documentation built on May 20, 2019, 7:38 a.m.