function_get_graph_1_n_group_centrality_with_function: Creates a ggraph object.

Description Usage Arguments Value Author(s) See Also Examples

Description

Creates the ggraph object, i.e. the graph depicting the words containing the variables vector wordvars The combinations of all word pairs are computed for all concecutive pair of variables and the centrality of each word is calculated according to centralityfunction.

Usage

1
2
3
4
5
get.graph.1.n.group.centrality.with.function(
        wordvars,
        centralityfunction,
        data.df,
        iscircled = FALSE)

Arguments

wordvars

The vector containing the names of the variables

centralityfunction

The centrality function to apply. Acceptable entries one of: tidygraph::centrality_authority(), tidygraph::centrality_betweenness(), tidygraph::centrality_closeness(), tidygraph::centrality_pagerank(), tidygraph::centrality_eigen(), tidygraph::centrality_alpha()

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 list contains the graph data for the selected centrality index.

Author(s)

Epaminondas Diamantopoulos

See Also

get.all.graphs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# It is a time consuming function...


agraph = get.graph.1.n.group.centrality.with.function(
    c("diet1stword", "diet2ndword", "diet3rdword"),
    tidygraph::centrality_authority(),
    freeassociationdata)

# To plot the graph simply call:
agraph

# The centrality scores are available at:agraph$data$centrality
hist(agraph$data$centrality)

# Other available centrality functions...

 agraph = get.graph.1.n.group.centrality.with.function(
             c("diet1stword", "diet2ndword", "diet3rdword"),
            tidygraph::centrality_betweenness(), freeassociationdata)

# Note: closeness centrality is not well-defined for disconnected graphs.
 agraph = get.graph.1.n.group.centrality.with.function(
             c("diet1stword", "diet2ndword", "diet3rdword"),
             tidygraph::centrality_closeness(), freeassociationdata)

 agraph = get.graph.1.n.group.centrality.with.function(
            c("diet1stword", "diet2ndword", "diet3rdword"),
            tidygraph::centrality_pagerank(), freeassociationdata)

 agraph = get.graph.1.n.group.centrality.with.function(
             c("diet1stword", "diet2ndword", "diet3rdword"),
             tidygraph::centrality_eigen(), freeassociationdata)

 agraph = get.graph.1.n.group.centrality.with.function(
            c("diet1stword", "diet2ndword", "diet3rdword"),
            tidygraph::centrality_alpha(), freeassociationdata)

wordgraph documentation built on July 1, 2020, 10:01 p.m.