title: Parse and Evaluate Column of String Expressions in R?
body: <p>How can I parse and evaluate a column of string expressions in R as part of a pipeline? </p>
  
  <p>In the example below, I produce my desired column, <code>evaluated</code>. But I know this isn't the right approach. I tried taking a tidyverse approach. But I'm just very confused. </p>
  
  <pre><code>library(tidyverse)
  df &lt;- tibble(name = LETTERS[1:3], 
               to_evaluate = c("1-1+1", "iter+iter", "4*iter-1"), 
               evaluated = NA)
  iter = 1
  for (i in 1:nrow(df)) {
    df[i,"evaluated"] &lt;- eval(parse(text=df$to_evaluate[[i]]))
  }
  print(df)
  # # A tibble: 3 x 3
  # name  to_evaluate evaluated
  # &lt;chr&gt; &lt;chr&gt;           &lt;dbl&gt;
  # 1 A     1-1+1               1
  # 2 B     iter+iter           2
  # 3 C     4*iter-1            3
  </code></pre>
  
  <p>As part of a pipeline, I tried:</p>
  
  <pre><code>df %&gt;% mutate(evaluated = eval(parse(text=to_evaluate)))
  df %&gt;% mutate(evaluated = !!parse_exprs(to_evaluate))
  df %&gt;% mutate(evaluated = parse_exprs(to_evaluate))
  df %&gt;% mutate(evaluated = eval(parse_expr(to_evaluate)))
  df %&gt;% mutate(evaluated = parse_exprs(to_evaluate))
  df %&gt;% mutate(evaluated = eval(parse_exprs(to_evaluate)))
  df %&gt;% mutate(evaluated = eval_tidy(parse_exprs(to_evaluate)))
  </code></pre>
  
  <p>None of these work.</p>