Closed peterduus closed 1 year ago
I solved this problem by modifying the following lines in the sparsify() Line 23: G <- backbone:::tomatrix(U) # I can't figure out why the function cannot recognize the namespace of backbone. Line 74 G <- matrix(0, nrow(original), ncol(original), dimnames = dimnames(original)) # the dimnames should not be NUll Line 266 backbone <- backbone:::frommatrix(G, attribs, convert = class)
Thanks for finding this and providing a fix. I'm still trying to figure out why functions in backbone aren't recognizing backbone's own namespace. But, once I figure that out, I'll incorporate your fix into the devel
version. I'm keeping this issue open until I get to that.
You're right that line 74 needs dimnames = dimnames(original)
. I've added that to the devel
branch, and it will be part of the next CRAN release.
You can install the new development version using devtools::install_github("zpneal/backbone", ref = "devel")
With this new version, your original command backbone:::sparsify.with.lspar(ttt, s = 0, class = 'igraph', narrative = T)
seems to work fine.
I'm not sure why backbone seemed to not be recognizing some functions in its own namespace before, but I can't replicate that issue. So, I didn't make any changes to the lines calling tomatrix()
or frommatrix()
.
Thanks again for letting me know about this bug! I'm marking the issue closed now, but let me know if you run into any other issues.
The sparsify() reported the following error:
Error in
[<-
(*tmp*
, Gedge[i, 1], Gedge[i, 2], value = "0") : no 'dimnames' attribute for arrayI think maybe it comes from the line23 in the sparsify(): G <- tomatrix(U). However, after modifying it to "G<-backbone::tomatrix(U)", it reports the "Error: 'tomatrix' is not an exported object from 'namespace:backbone'". If I modified the codes as "G<-backbone:::tomatrix(U)", the original error reoccurred. I reinstalled the package and the error remained unsolved. So is there any other possible solution for this issue?
Here are my codes and the sample igraph object:
backbone:::sparsify.with.lspar(ttt, s = 0, class = 'igraph', narrative = T)
https://www.dropbox.com/s/hqkewubjs260g63/sampleGrp.rda?dl=0