first.author.graph: Create a graph from conversation data

Description Usage Arguments Value Examples

Description

Create a graph from conversation data, in which ties are drawn between each authors in the conversation and the first author.

Usage

1
2
first.author.graph(conversation, author, order.nr, direction = "directed.up",
  once.per.conversation = TRUE)

Arguments

conversation.id

A vector representing the conversation authors were engaged in (e.g. a thread, meeting)

author

A vector with unique author names/ids

order.nr

Optional. A vector representing the order in which authors communicated within a conversation.

direction

A character string, indicating the direction of the ties. If 'undirected', ties between authors go both ways. If 'directed.up', ties are directed from author to previous authors (only if order is given). if 'directed.down', ties are directed from author to later authors.

once.per.conversation

Logical. If TRUE, count only the number of conversations in which a first-author <-> later-author coincidence occurs. It is then ignored how many times the later author participated in the conversation. If FALSE, the number of participation times is counted.

Value

A graph object in the igraph format

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
d = data.frame(conversation=c(1,1,1,1,1,1,2,2,2,2),
              author=c('Alice','Bob','Alice','Dave','Bob','Bob','Alice','Bob','Alice','Bob'),
              order.nr=c(1,2,3,4,5,6,1,2,3,4))
g = first.author.graph(d$conversation, d$author, d$order.nr) # in how many conversations initiated by author.Y did author.X communicate?
plot(g, edge.label=E(g)$weight, vertex.size=V(g)$n.documents*25)
g = first.author.graph(d$conversation, d$author, d$order.nr, once.per.conversation=FALSE) # how many times did author.X communicate in a conversation initiated by author.Y?
plot(g, edge.label=E(g)$weight, vertex.size=V(g)$n.messages*15)
g = first.author.graph(d$conversation, d$author, d$order.nr, direction='undirected') # drop direction author.X and author.Y
plot(g, edge.label=E(g)$weight, vertex.size=V(g)$n.documents*25)
g = first.author.graph(d$conversation, d$author, d$order.nr, direction='directed.down') # switch direction
plot(g, edge.label=E(g)$weight, vertex.size=V(g)$n.documents*25)

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