gordy2x / ecoCopula

R package to find species interactions from co-occurrence data
14 stars 9 forks source link

Error in names(x) <- value : 'names' attribute [3] must be the same length as the vector [2] #2

Closed bettasimousss closed 4 years ago

bettasimousss commented 4 years ago

Hi, I encountered this error that seems to arise from graph_from_partial This line of code: colnames(Edges)[3]<- "partcor"

It seems it happens when the model infers a diagonal association matrix (empty graph).

liaojiahui-r commented 4 years ago

I'm struggling with this problem too 0^0

I used my data (be the same structure with spider data), all code ran well except my_gr = cgr(my_mod) (failed to generate a graph)

part of my data dt = " Plant10 Plant15 Plant33 Plant48 Plant49 Plant5 Plant65 Plant16 Plant27 Plant32 0 23 2 0 0 0 1 0 0 27 29 28 3 0 0 1 5 0 2 47 0 19 23 6 2 1 0 0 8 88 5 2 0 0 0 14 0 0 1 0 3 6 0 0 0 23 0 5 3 0 58 2 0 0 0 6 0 0 0 0 2 8 6 0 0 0 4 0 9 0 0 19 0 0 0 2 6 0 0 55 6 14 22 0 0 8 3 0 7 20 "

gordy2x commented 4 years ago

Thank you SoccoCMOS and liaojiahui for pointing out this bug. As SoccoCMOS expected, it happens when the graph is empty. I've fixed it (I think), please let me know if you still have issues.

gordy2x commented 4 years ago

Sorted.