title: How do you output the values along branches of a tree in R?
body: <p>Given any data frame, how do I get a tree or a list that tells me the value along each of the branches of a tree in R?</p>
  
  <p>For instance, if I have a data frame that looks like:</p>
  
  <pre>
  Gender      Under 18?   Student            
  M           Y           Y
  F           Y           Y
  M           N           Y
  M           Y           Y
  F           N           N
  M           N           N
  F           N           N
  F           Y           N
  M           Y           N
  </pre>
  
  <p>How do I output the values along the branches like in the tree below?</p>
  
  <p>Tree with values along branches</p>
  
  <p><a href="https://i.stack.imgur.com/BfH1R.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BfH1R.png" alt=""></a></p>