title: Write dataframe to yaml R
body: <p>I have a dataframe:</p>
  
  <pre><code>df &lt;- data.frame(name = c("bob","joe"),
                   target = c("yellow", "grey"),
                   code1 = c("fly", "walk"),
                   code2 = c("jump", "run"))
  </code></pre>
  
  <p>And I would like to write the information to a yaml file with a specific structure:</p>
  
  <pre><code>samples:
          bob:
              target: yellow
              code1: fly
              code2: jump
  
          joe:
              target: grey
              code1: walk
              code2: run
  </code></pre>
  
  <p>I am having trouble achieving a yaml output with this specific structure.</p>