##读入数据
URL <- paste0("https://cdn.rawgit.com/christophergandrud/networkD3/","master/JSONdata/energy.json")
Energy <- jsonlite::fromJSON(URL)
##查看数据构成
str(Energy)
List of 2
$ nodes:'data.frame': 48 obs. of 1 variable:
..$ name: chr [1:48] "Agricultural 'waste'" "Bio-conversion" "Liquid" "Losses" ...
$ links:'data.frame': 68 obs. of 3 variables:
..$ source: int [1:68] 0 1 1 1 1 6 7 8 10 9 ...
..$ target: int [1:68] 1 2 3 4 5 2 4 9 9 4 ...
..$ value : num [1:68] 124.729 0.597 26.862 280.322 81.144 ...