title: find all descendants of a parent using recursive merge function or something else?
body: <p>So I have a large data.frame. First column is parent, second column is child. </p>
  
  <ul>
  <li>1 -> 2 </li>
  <li>1 -> 3  </li>
  <li>2 -> 3  </li>
  <li>2 -> 4</li>
  <li>2 -> 5</li>
  <li>6 -> 7</li>
  <li>6 -> 8</li>
  <li>7 -> 9</li>
  </ul>
  
  <p>and so on.. </p>
  
  <p>Problem: For a subsample of parents, I want to find all their descendants. That is, for a set of parents, I need their children, grandchildren, etc... </p>
  
  <p>Example of output: Using the numbers above, if I wanted to get a data.frame containing the descendants of 1, I'd get</p>
  
  <ul>
  <li>1 -> 2 </li>
  <li>1 -> 3  </li>
  <li>2 -> 3  </li>
  <li>2 -> 4</li>
  <li>2 -> 5</li>
  </ul>
  
  <p>But not below since these are not descendants of 1. They come from a different family. </p>
  
  <ul>
  <li>6 -> 7</li>
  <li>6 -> 8</li>
  <li>7 -> 9</li>
  </ul>
  
  <p>What would be the best way to do this? </p>
  
  <p>A recursive function of self-joins using merge function? If so, any good examples?</p>
  
  <p>Or is there a package with this functionality already?</p>