0

I want to use the library edgebundleR in R. But I get the following Error message if I want to parse the json file (edgebundle("test.json"):

Error in rjson::fromJSON(file = x) : no data to parse In addition: Warning message: In file(con, "r") : file("") only supports open = "w+" and open = "w+b": using the former

The json file looks like this:

[

{"name": "A.A1", "imports": ["Emp.Emp1", "Emp.Emp2"]},

{"name": "A.A2", "imports": ["Emp.Emp3", "Emp.Emp2"]},

{"name": "A.A3", "imports": ["Emp.Emp1", "Emp.Emp3"]},

{"name": "C.C1", "imports": ["Emp.Emp1", "Emp.Emp3"]},

{"name": "C.C2", "imports": ["Emp.Emp2", "Emp.Emp3"]},

{"name": "C.C3", "imports": ["Emp.Emp1", "Emp.Emp2"]},
                            
{"name": "B.B1", "imports": ["Emp.Emp1", "Emp.Emp3"]},

{"name": "B.B2", "imports": ["Emp.Emp2", "Emp.Emp3"]},
                                              
{"name": "B.B3", "imports": ["Emp.Emp1", "Emp.Emp2"]},
                        
{"name": "Emp.Emp1", "imports": ["A.A1","A.A3","B.B1","B.B3","C.C1","C.C3"]},
  
{"name": "Emp.Emp3", "imports": ["A.A3","A.A2","B.B2","B.B1","C.C2","C.C1"]},

{"name": "Emp.Emp2", "imports": ["A.A1","A.A2","B.B2","B.B3","C.C2","C.C3"]}

]

Here is my R code:

require(edgebundleR)
require(igraph)
library("rjson")

filepath = system.file("sampleData", "test.json", package = "edgebundleR")

edgebundle(filepath,width=800,fontsize=8,tension=0.95)

Refering on this: https://cran.r-project.org/web/packages/edgebundleR/README.html[enter link description here]1

r2evans
  • 141,215
  • 6
  • 77
  • 149
Sahin
  • 1
  • FYI, don't use `require` without checking its return value, see https://stackoverflow.com/a/51263513/3358272, https://yihui.org/en/2014/07/library-vs-require/, https://r-pkgs.org/namespace.html#search-path. (The fact that the [`edgebundleR` vignette](https://github.com/garthtarr/edgebundleR/blob/master/vignettes/edgebundleR.Rmd) does it too does not make it right ... and is perhaps a *little* concerning :-) – r2evans Dec 15 '21 at 14:44
  • Up front, I know nothing about `edgebundleR`, but the [sample data in `flare-imports.json`](https://github.com/garthtarr/edgebundleR/blob/master/inst/sampleData/flare-imports.json) is a list of dictionaries where each has names `"name"`, `"size"`, and `"imports"`; yours is missing `"size"`. Is that meaningful? – r2evans Dec 15 '21 at 14:48
  • 1
    I also tried to use the "size", but it shows the same error. – Sahin Dec 15 '21 at 15:06

0 Answers0