This is not a but report, but a feature suggestion :)
It would be nice to have a function that returns the signed triangles, including their class (---, --+, -++, +++) in addition to their counts. You can easily get that by performing a few changes in your signed_triangles function. For instance:
cls <- apply(emat, 1, function(v) length(which(v==1)))
will give you the class of each triangle, as an integer corresponding to the number positive links in the triangle. If you cbind that to tmat, you get a 4-column matrix containing the triangles as well as their sign class.
This is not a but report, but a feature suggestion :)
It would be nice to have a function that returns the signed triangles, including their class (---, --+, -++, +++) in addition to their counts. You can easily get that by performing a few changes in your
signed_triangles
function. For instance:cls <- apply(emat, 1, function(v) length(which(v==1)))
will give you the class of each triangle, as an integer corresponding to the number positive links in the triangle. If youcbind
that totmat
, you get a 4-column matrix containing the triangles as well as their sign class.