title: paste function for labeling in ggplot2
body: <p>In the following plot, I want to rename x-axis by <code>paste0</code> function.</p>
  
  <pre class="lang-r prettyprint-override"><code>daata &lt;- data.frame(
    q = paste0("q",1:20),
    value = runif(n = 20, 2, 10))
  
  ggplot2::ggplot(data = daata, aes(x = q, y = value)) +
    geom_col()
  </code></pre>
  
  <p>so I used the following code:</p>
  
  <pre class="lang-r prettyprint-override"><code>q = paste0("q",1:20)
  labels &lt;- paste0("'", q,"'" , " = ", 1:20) %&gt;% noquote()
  # Or
  labels &lt;- noquote(paste0("'", q,"'" , " = ", 1:20))
  
  ggplot2::ggplot(data = daata, aes(x = q, y = value)) +
    geom_col() + 
    scale_x_discrete(labels = labels)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/WjWNP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WjWNP.png" alt="enter image description here"></a></p>
  
  <h2>But it did not work. Why? (main question)</h2>
  
  <p>I want to search for solutions that make <code>labels = c("'q1' = 1", ...)</code> works.</p>
  
  <h3>Beside <code>paste</code> function I know two alternatives.</h3>
  
  Using list:
  
  <pre class="lang-r prettyprint-override"><code>labels = sapply(1:20, list)
  names(labels) &lt;- daata$q
  ggplot2::ggplot(data = daata, aes(x = q, y = value)) +
    geom_col() + 
    scale_x_discrete(labels = labels)
  </code></pre>
  
  Using function:
  
  <pre class="lang-r prettyprint-override"><code>ggplot2::ggplot(data = daata, aes(x = q, y = value)) +
    geom_col() + 
    scale_x_discrete(labels = function(i){gsub("q", "", i)})
  </code></pre>
  
  <p>I am eager to know other solutions too.  </p>