Learn R Programming

tma (version 0.3.1)

tma.conversations: Find conversations by unit

Description

Identify and extract rows corresponding to conversations for specified units in a dataset or context model. Useful for subsetting and analyzing conversational windows in network analysis.

Usage

tma.conversations(
  x,
  units,
  units.by = NULL,
  codes = NULL,
  conversation.by = NULL,
  window = 4,
  conversation.exclude = c(),
  id_col = "QEUNIT"
)

Value

A list with elements:

conversations

List of row indices for each conversation.

unitConvs

Unique conversation keys for the specified units.

allRows

All row indices included for the units.

unitRows

Row indices for the units with codes.

convRows

All row indices for the unit's conversations.

toRemove

Rows not meeting co-occurrence criteria.

Arguments

x

A data.frame or context model containing conversation data.

units

Character vector of unit identifiers to extract conversations for.

units.by

Character vector of column names specifying unit grouping (default: from context model attributes).

codes

Character vector of code columns to use for identifying coded rows.

conversation.by

Character vector of column names to group by conversation.

window

Integer; window size for co-occurrence (default: 4).

conversation.exclude

Character vector of conversation keys to exclude.

id_col

Character; column name for unit IDs (default: "QEUNIT").

Details

This function groups rows by conversation (using `conversation.by` columns), identifies which rows are associated with the specified units and codes, and returns indices for each conversation, as well as metadata about which rows to include or exclude.