biometry / bipartite

repository for the bipartite R-package for network analysis
36 stars 17 forks source link

Error in degree distribution metric in networklevel function #23

Closed CynOliveira closed 1 month ago

CynOliveira commented 1 month ago

Hi, I'm trying to calculate the degree distribution using the networklevel function of the package but I'm getting the following error: "Error in outg[[2]] : subscript out of bounds" This error appears for any network I try, including those provided in the data of the package. I know that there is a possibility of calculating it directly using the degreedistr function and that way there is no error. However, I work with a raster extension of your package, via the terra package, and I've been trying to calculate all the network metrics using networklevel. I'm using the latest versions of bipartite and R. Many thanks in advance for your support,

Best

cdormann commented 1 month ago

Hi "Best", can you please provide a minimal working example. I cannot reproduce your problem:

networklevel(small1976, index="degree distribution") $degree distribution.HL Estimate Std. Error Pr(>|t|) R2 AIC exponential 0.2680213 0.03273948 3.697979e-05 0.9722957 -15.399690 power law 0.7400093 0.15118512 1.201759e-03 0.8898738 -2.326445 truncated power law -0.6025852 0.21573195 2.678430e-02 0.9874580 -21.761164

$degree distribution.LL Estimate Std. Error Pr(>|t|) R2 AIC exponential 0.08283741 0.01764426 0.002221825 0.8911838 -4.223280 power law 0.47716304 0.14041287 0.011469228 0.7810884 1.398351 truncated power law -0.58414098 0.34966858 0.145845464 0.9308149 -6.052836

(Note, however, that I use the current github version (2.20). But I haven't touched networklevel for a long time (2.17), and even then for a different index.)

CynOliveira commented 1 month ago

Hi,

Until yesterday I had been trying many times with different networks and I was always getting the same error that I reported briefly. Even after restarting the sessions, uninstalling and reinstalling the bipartite again. Today I was able to calculate the degree of distribution normally by the networklevel. I don't know what happened, but I appreciate your attention and help.

Best,

Cynthia Oliveira