christophergandrud / networkD3

D3 JavaScript Network Graphs from R
http://christophergandrud.github.io/networkD3
649 stars 270 forks source link

Error in unclass(x) : cannot unclass an environment #260

Closed anirudhprabhu closed 5 years ago

anirudhprabhu commented 5 years ago

Hi. I am trying to create a radialNetwork. I used the data.tree package to create the object for the visualization. The code looks as follows:

library(data.tree)

DanaMin$pathString <- paste("DANA", DanaMin$DANA_1, DanaMin$DANA_2, DanaMin$DANA_3, DanaMin$DANA_4, DanaMin$MINERAL, sep = "/")
population <- as.Node(DanaMin,pathDelimiter = "/")

library(networkD3)
useRtreeList <- ToListExplicit(population, unname = T)
radialNetwork(useRtreeList,width = 5000,height = 5000)

I could not find a solution to this problem online. Please advice on how to proceed.

Thank you.

cjyetman commented 5 years ago

I suspect there's something wrong with your data, but I can't reproduce your problem because I don't have access to your DanaMin object. The following reproducible example works...

library(data.tree)
library(networkD3)
data(acme)
useRtreeList <- ToListExplicit(acme, unname = TRUE)
radialNetwork(useRtreeList)

Also, width = 5000 and height = 5000 arguments seem unreasonably large.

cjyetman commented 5 years ago

no response with additional information, so closing