christophergandrud / networkD3

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

add nodes_links function #269

Closed sylvaine31 closed 4 years ago

sylvaine31 commented 4 years ago

Hi, I create a nodes_links function that generate the nodes and links dataframe for using with sankeynetwork. You just have to run the function on your initial dataset, precising the factor variables of interest. It generates locally the nodes and links dataframes that you can directly use in the sankeyNetwork. The function could surely be improved but is still very convenient.

cjyetman commented 4 years ago

Thanks for the effort and interest. There are a few problems here...

  1. the build is failing with this PR
  2. it adds a dependency on dplyr (and therefore all of its dependencies), which would be better to avoid
  3. the function and example cause an error on my machine, possibly because I have a newer version dplyr/tidyselect: Note: Using an external vector in selections is ambiguous. ℹ Use all_of(variables) instead of variables to silence this message. ℹ See https://tidyselect.r-lib.org/reference/faq-external-vector.html.
  4. this function seems to be very specific to a certain type of data... I'm not sure it has general enough utility