prepare_data: Prepare communication network data for analysis.

Description Usage Arguments Value Examples

View source: R/prepare_data.R

Description

Reads in and stores communication network data in a ComNet object for use in main estimation procedure.

Usage

1
2
prepare_data(document_authors, document_edge_matrix, document_term_matrix,
  covariate_data = NULL, vocabulary = NULL)

Arguments

document_authors

A vector recording the index of the sender of each document. This vector must be equal in length to the number of documents in the corpus, and should be one-indexed.

document_edge_matrix

A documents (rows) by actors (columns) matrix recording whether actor j was a recipient of message i. This matrix should be one-indexed.

document_term_matrix

A documents (rows) by unique terms (columns) matrix recording the count of unique term j in document i.

covariate_data

Defaults to NULL. The user may provide a data.frame containing covariate data for each actor. This data frame must have the same number of rows as actors, and should use descriptive variable names.

vocabulary

Defaults to NULL, in which case the column names of the document_term_matrix will be used as the vocabulary.

Value

An object of class ComNet that will be used by the ccas() function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
# load in example county government email data.
data(author_attributes)
data(document_edge_matrix)
data(document_word_matrix)
data(vocabulary)

# the first colun of the doc-edge matrix is the author index. Take it out and
# then remove it from the doc-edge matrix.
document_authors <- document_edge_matrix[,1]
document_edge_matrix <- document_edge_matrix[,-1]
ComNet <- prepare_data(
document_authors = document_authors,
document_edge_matrix = document_edge_matrix,
document_term_matrix = document_word_matrix,
covariate_data = author_attributes,
vocabulary = vocabulary)

## End(Not run)

matthewjdenny/CCAS documentation built on May 21, 2019, 1:01 p.m.