doc_group: Construct network of documents based on keyword co-occurrence

View source: R/doc_group.R

doc_groupR Documentation

Construct network of documents based on keyword co-occurrence

Description

Create a tbl_graph(a class provided by tidygraph) from the tidy table with document ID and keyword. Each entry(row) should contain only one document and keyword in the tidy format.This function would group the documents.

Usage

doc_group(
  dt,
  id = "id",
  keyword = "keyword",
  com_detect_fun = group_fast_greedy
)

Arguments

dt

A data.frame containing at least two columns with document ID and keyword.

id

Quoted characters specifying the column name of document ID.Default uses "id".

keyword

Quoted characters specifying the column name of keyword.Default uses "keyword".

com_detect_fun

Community detection function,provided by tidygraph(wrappers around clustering functions provided by igraph), see group_graph to find other optional algorithms. Default uses group_fast_greedy.

Details

As we could classify keywords using document ID, we could also classify documents with keywords. In the output network, the nodes are documents and the edges mean the two documents share same keywords with each other.

Value

A tbl_graph, representing the document relation network based on keyword co-occurrence.

Examples

 library(akc)
 bibli_data_table %>%
   keyword_clean(id = "id",keyword = "keyword") %>%
   doc_group(id = "id",keyword = "keyword") -> grouped_doc

 grouped_doc

akc documentation built on Jan. 6, 2023, 9:09 a.m.