title: Concatenating key value pairs from a list in R
body: <p>I have a list of objects that I would like to concatenate into a string. This will ultimately be used to construct a SQL statement. </p>
  
  <pre><code>library(purrr)
  test &lt;- list(key = "value", key1 = "value1", key2 = "value2")
  
  &gt; test
  $key
  [1] "value"
  
  $key1
  [1] "value1"
  
  $key2
  [1] "value2"
  
  map2(names(test), test, ~paste(.x, "=", .y)) %&gt;% 
    reduce(c) %&gt;% 
    paste0(collapse = ", ")
  
  </code></pre>
  
  <p>This gives the desired result, but wondering if I'm missing a more obvious solution. </p>
  
  <pre><code>[1] "key = value, key1 = value1, key2 = value2"
  </code></pre>