{"action":"created","issue":{"url":"https://api.github.com/repos/DataKnowledge/visNetwork/issues/50","repository_url":"https://api.github.com/repos/DataKnowledge/visNetwork","labels_url":"https://api.github.com/repos/DataKnowledge/visNetwork/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/DataKnowledge/visNetwork/issues/50/comments","events_url":"https://api.github.com/repos/DataKnowledge/visNetwork/issues/50/events","html_url":"https://github.com/DataKnowledge/visNetwork/issues/50","id":131894259,"number":50,"title":"How to assign nodes to a new group without redrawing the whole network?","user":{"login":"tleja","id":5081681,"avatar_url":"https://avatars.githubusercontent.com/u/5081681?v=3","gravatar_id":"","url":"https://api.github.com/users/tleja","html_url":"https://github.com/tleja","followers_url":"https://api.github.com/users/tleja/followers","following_url":"https://api.github.com/users/tleja/following{/other_user}","gists_url":"https://api.github.com/users/tleja/gists{/gist_id}","starred_url":"https://api.github.com/users/tleja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tleja/subscriptions","organizations_url":"https://api.github.com/users/tleja/orgs","repos_url":"https://api.github.com/users/tleja/repos","events_url":"https://api.github.com/users/tleja/events{/privacy}","received_events_url":"https://api.github.com/users/tleja/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-02-06T20:14:39Z","updated_at":"2016-02-26T20:28:41Z","closed_at":null,"body":"Hi, it's a great package! I have a large network, which I am partitioning into multiple groups. Is there a way to assign the nodes to a new group without redrawing the network? or, is there a way to re-colour the nodes based on the new group? See the minimal example below:\r\n\r\n```\r\nnodes <- data.frame(id = 1:5, group=c(1,1,1,2,2))\r\nedges <- data.frame(from = c(1,2,2,3,3,4), to = c(1,3,4,5,1,3))\r\n\r\nnetwork <- visNetwork(nodes, edges)\r\n\r\nnew_group = c(1,2,2,3,3)\r\nnetwork <- visNodes(network, group=new_group) # or use color=new_group ?\r\n\r\nnetwork # the resulting graph doesn't reflect the 'new_group' arrangement\r\n```\r\n\r\nI would like to embed this solution into my shiny app, perhaps using `visNetworkProxy`. \r\nI thought of creating a `matrix` binding all group vectors together, where each column = a group vector. Then using a `sliderInput` in shiny to select a column index for each group vector:\r\n```\r\nvisNetworkProxy(\"network\") %>% visNodes(group = matrix[,input$matrix_index])\r\n```\r\nHopefully this would re-colour the nodes and the legend based on the new group arrangement (without redrawing the whole network).\r\n\r\nAny suggestions would be much appreciated!"},"comment":{"url":"https://api.github.com/repos/DataKnowledge/visNetwork/issues/comments/189470808","html_url":"https://github.com/DataKnowledge/visNetwork/issues/50#issuecomment-189470808","issue_url":"https://api.github.com/repos/DataKnowledge/visNetwork/issues/50","id":189470808,"user":{"login":"bthieurmel","id":8750326,"avatar_url":"https://avatars.githubusercontent.com/u/8750326?v=3","gravatar_id":"","url":"https://api.github.com/users/bthieurmel","html_url":"https://github.com/bthieurmel","followers_url":"https://api.github.com/users/bthieurmel/followers","following_url":"https://api.github.com/users/bthieurmel/following{/other_user}","gists_url":"https://api.github.com/users/bthieurmel/gists{/gist_id}","starred_url":"https://api.github.com/users/bthieurmel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bthieurmel/subscriptions","organizations_url":"https://api.github.com/users/bthieurmel/orgs","repos_url":"https://api.github.com/users/bthieurmel/repos","events_url":"https://api.github.com/users/bthieurmel/events{/privacy}","received_events_url":"https://api.github.com/users/bthieurmel/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T20:28:41Z","updated_at":"2016-02-26T20:28:41Z","body":"Yes. Some adjustments needed...!"}}