title: Creating formulas out of a list of strings
body: <p>I have the following code to parse a string into a list called <code>dag_str2</code>. It's coming out as a nested list and I would want it as just a regular list.</p>
  <pre><code>dag_str &lt;- &quot;dag{D&lt;-{G}; A&lt;-{D}; A&lt;-{G}; A&lt;-{Q}}&quot; 
  dag_str2 &lt;- gsub(&quot;dag|\\{|\\}|[[:space:]]&quot;,&quot;&quot;, dag_str) %&gt;%
    str_split(&quot;;&quot;)
  
  dag_str2
  [[1]]
  [1] &quot;D&lt;-G&quot; &quot;A&lt;-D&quot; &quot;A&lt;-G&quot; &quot;A&lt;-Q&quot;
  
  </code></pre>
  <p>I want the output to be a list of formulas like so
  Output: List like this</p>
  <pre><code>&quot;D~G&quot; &quot;A~D+G+Q&quot;
  
  </code></pre>
  <p>How can I do this in R?</p>