Learn R Programming

wordgraph (version 0.1.0)

get.word.combinations.as.tbl_graph: Calculate all word pairs frequencies.

Description

Calculate all word pairs frequencies among concecutive variables in wordvars vector and return a tidygraph::as_tbl_graph object in order to be used to create the graph.

Usage

get.word.combinations.as.tbl_graph(
                      wordvars,
                      data.df,
                      iscircled = FALSE)

Arguments

wordvars

The vector containing the names of the variables

data.df

The data frame where the variables belong.

iscircled

Should take also the combination between last and first variable (var_n - var1)? Default is FALSE.

Value

A tidygraph::as_tbl_graph object containing the frequencies of all value pairs between concecutive variables in wordvars vector.

Examples

Run this code
# NOT RUN {
# It is a time consuming function...
# Thus, for illustrative purposes, an example is provided in a
# small random subset of the original data...

freeassociationdata_part = dplyr::sample_n(freeassociationdata, 10)

df.word.combinations.as.tbl_graph = get.word.combinations.as.tbl_graph(
c("diet1stword", "diet2ndword", "diet3rdword"), freeassociationdata_part)

print(df.word.combinations.as.tbl_graph)
# }

Run the code above in your browser using DataLab