1

so first of all, I am new to network analysis and creating networks. My apologies in case this is a very simple question but I cannot find answers online. I am trying to plot a network from a adjacency matrix. In case it matters, the data is from the Discourse Network Analyzer package written by Philip Leifeld. However, I am trying to create the network with ggnet2. The edge sizes should represent the strength of agreement between the actors but I just cannot figure out how to do it.

EDIT: My data

> dput(nw)
structure(c(0, 51, 7, 56, 51, 0, 8, 23, 7, 8, 0, 3, 56, 23, 3, 
0), .Dim = c(4L, 4L), .Dimnames = list(c("A", 
"B", "C", "D"), c("A", "B", 
"C", "D")), start = structure(-2208992400, tzone = "", class = c("POSIXct", 
"POSIXt")), stop = structure(4102441199, tzone = "", class = c("POSIXct", 
"POSIXt")), call = dna_network(connection = conn, networkType = "onemode", 
    statementType = "DNA Statement", variable1 = "actor", 
    variable2 = "concept", qualifier = "agreement", qualifierAggregation = "congruence", 
    duplicates = "document"), class = c("dna_network_onemode", 
"matrix"))

My code so far:

 library(ggplot2)
library(GGally)
library(network)
library(sna)
library(intergraph)
library(rJava)

library("rDNA")

dna_init()

conn <- dna_connection("data", verbose = FALSE)

nw <- dna_network(conn, networkType = "onemode",
                  statementType = "DNA Statement",
                  variable1 = "actor",
                  variable2 = "concept",
                  qualifier = "agreement",
                  qualifierAggregation = "congruence",
                  duplicates = "document")

nw_net <- network(nw, 
                  matrix.type = "adjacency")

nw_nett <- network.adjacency(nw, nw_net, names.eval = "weight")

ggnet2(nw_nett, size = 6, 
       color = c("chartreuse", "black", "darkgoldenrod1", "firebrick1"),
       label = c("A", "B", "C", "D"), 
       label.size = 3, 
       edge.size = "weight")

I realize that this is probably a very simple problem and there is just something missing but I honestly do not know what. Any help would be appreciated

  • Hi, please provide your data in a reproducible format, for example by using `dput`. See this post on [how to make a great R reproducible example](https://stackoverflow.com/a/5963610/1335174) – alex_jwb90 Nov 18 '20 at 12:57
  • Thanks for the heads up. I added it. Let me know if anything else is missing :) – thisismyname Nov 18 '20 at 13:08

0 Answers0