title: NetworkD3 Sankey Plot in R: How to switch text labels from the right to the left of the inner nodes only
body: <p>I created a Sankey Plot using the NetworkD3 R package. Below is an example of the output:   </p>
  
  <p><a href="https://i.stack.imgur.com/6CyRT.jpg" rel="nofollow noreferrer">Sankey Plot Example</a></p>
  
  <p>I used the following code for the Sankey:</p>
  
  <pre><code>sankeyNetwork(Links = SankeyLinks, Nodes = SankeyNodes, Source = "source",
            Target = "target", Value = "value", NodeID = "names", 
            fontSize = 14, nodeWidth = 20,nodePadding = 15,NodeGroup = "nodeColor",
            colourScale = JS(ColourScale), LinkGroup = "linkColor",
            sinksRight = T)
  </code></pre>
  
  <p>The network generates text labels to the right of the middle nodes, which crowds the links to the leaf nodes. I would like to switch the text to the <em>left side</em> of the inner nodes <em>without</em> changing the text placement on the beginning node  and leaf nodes (right and left, respectively). </p>
  
  <p>I have researched a similar question: <a href="https://stackoverflow.com/questions/35215306/place-text-values-to-right-of-sankey-diagram">Place text values to right of sankey diagram</a> </p>
  
  <p>Here is another:
  <a href="https://stackoverflow.com/questions/37960985/how-to-place-node-title-to-the-left-or-right-of-the-node-in-d3-sankey-graph">How to place node title to the left or right of the node in d3 Sankey graph?</a></p>
  
  <p>The answers are coded in D3.js, which I have not yet learned and don't know how to implement into my R code, or they are moving text labels to the right of the nodes. </p>
  
  <p>Any suggestions that I can implement into R to move text of the inner nodes to the left would be greatly appreciated! </p>
  
  <p>Edit: Using the example code given in the comment, when I use the set.seed it doesn't create inner nodes, so maybe that is the issue?
  <a href="https://i.stack.imgur.com/DRuKa.jpg" rel="nofollow noreferrer">Output Example</a></p>