Closed mschalberger closed 2 months ago
Interesting. It looks like L()
doesn't unpack the networks correctly, though in principle it should.
summary(nets ~ N(~edges) + N(~L(~edges, ~`+`)) + N(~L(~edges, ~`-`)))
produces the expected result. I'll look into it, but it would probably be easier to add a warning to layer logic helper functions when there is non-layer structure on top of them.
And thanks for the bug report!
Turns out that this can sometimes even crash R, so I am going to go ahead and make it an error to unpack things in the wrong order. If there is a use case for it, please open a ticket.
Description
I want to use the
Networks()
function to combine several multi-layer networks (specified with theLayer()
function) to use network-specific terms (N()
). However, it appears that the statistics calculated across layers do not match the statistics calculated over the whole network.To reproduce
To illustrate this behaviour, I will use the New Guinea Highlands Tribes dataset. Three multilayer networks consisting of two layers (positive and negative) are combined into a multilayer network representation.
Issue
Each tribe data set consists of 58 edges (29 positive and 29 negative). The edges term is, as expected, the number of networks multiplied by the number of edges, giving 174. However, for the layer specific terms I still get 29 and 29 instead of 87 and 87.