title: Manipulating character vectors: removing and adding quotes, adding strings
body: <p>I have <code>vector_1</code>, which I want to manipulate with code so that <code>vector_2</code> and <code>vector_3</code> are generated automatically.</p>
  <pre><code># What I have
  &gt; vector_1 &lt;- c(&quot;Group_A&quot;, &quot;Group_B&quot;, &quot;Group_C&quot;, &quot;Group_D&quot;)
  &gt; vector_1
  [1] &quot;Group_A&quot; &quot;Group_B&quot; &quot;Group_C&quot; &quot;Group_D&quot;
  </code></pre>
  <p>I want to achieve the following:</p>
  <pre><code># What I want to achieve by manipulating vector_1: 
  vector_2 = c(&quot;Group_A, Group_B, Group_C, Group_D&quot;)
  vector_3 = c(&quot; &quot;, &quot;Group_A&quot; = 3, &quot;Group_B&quot; = 3, &quot;Group_C&quot; = 3, &quot;Group_D&quot; = 3))
  </code></pre>
  <p>I assume <code>noquote()</code> is a starting point, but then I get stuck.</p>
  <pre><code>&gt; vector_x &lt;- noquote(vector_1)
  &gt; vector_x
  [1] Group_A Group_B Group_C Group_D
  # Here I'm stuck...
  </code></pre>
  <p>Base R would do, but I prefer to work in the tidyverse, with or without pipes.</p>
  <p>--- Edit ---</p>
  <p>Following up Sotos' question in the comments:</p>
  <p>I want to use <code>vector_3</code> as a header in <code>kableExtra</code>.
  Instead of writing...</p>
  <pre><code>kbl(
  [hidden code] %&gt;%
  add_header_above(c(&quot; &quot;, &quot;Group_A&quot;=3, &quot;Group_B&quot;=3, &quot;Group_C&quot;=3, &quot;Group_D&quot;=3)) %&gt;%
  [more_code]
  )
  </code></pre>
  <p>I haven't been able to make a reproducible example that works outside of PDF. Here's a link to <code>add_header_above()</code>:</p>
  <p><a href="https://www.rdocumentation.org/packages/kableExtra/versions/1.3.4/topics/add_header_above" rel="nofollow noreferrer">https://www.rdocumentation.org/packages/kableExtra/versions/1.3.4/topics/add_header_above</a></p>