1

I would like to calculate a triad census of an undirected, weighted edgelist in R (using sna, igraph and statnet packages). gdrkz is an object of class igraph.

When using the following command:

triad.census(gdrkz, g=NULL, mode = c("graph"))

I get the following error message:

Error in triad.census(gdrkz, g = NULL, mode = c("graph")) : 
  unused arguments (gdrkz, mode = c("graph"))

When I try:

triad.census(gdrkz, mode = c("graph"))

I get the message:

Error in triad.census(gdrkz, mode = c("graph")) : 
  unused argument (mode = c("graph"))

The following command seems to work:

triad.census(gdrkz)

with the result:

29394     0  2427     0     0     0     0     0     0     0   672     0     0     0     0    16

But I get a warning message:

In triad.census(gdrkz) :
  At motifs.c:1052 :Triad census called on an undirected graph

Can I treat this output nonetheless like a normal result from a triad census for undirected graphs (by interpreting reciprocal dyads just as connected, undirected ones and ignoring all the surplus combinations that are not possible in an undirected graph)?

gvegayon
  • 812
  • 12
  • 23
morph
  • 21
  • 2

1 Answers1

1

Ah, I have solved the problem:

I should have written:

sna::triad.census(gdrkz, g=NULL, mode = c("graph"))

which returns four values:

248635 10570 925 0

Sorry, I'm a beginner :)

morph
  • 21
  • 2
  • You have to notice that the order in which the packages are loaded matters. Both `sna` and `igraph` have a function with the name `triad.census`, and whichever package was loaded last will be the default method that R uses. Using the double colon helps to disambiguate the call, that's why this works. HIH – gvegayon Nov 19 '19 at 18:19