title: How to use double curly brackets in R with ggplot and dates?
body: <p>I'm trying to use double curly brackets in a function that makes a timeseries plot, and I've hit a wall, despite reading this <a href="https://stackoverflow.com/questions/64065003/how-do-double-curly-brackets-work-in-dplyr">overview</a> on how double curly brackets generally work.</p>
  <p>In this function, users specify the time period that they want the plot to focus on (week or month). If the user chooses &quot;Month&quot;, then the plot's X axis should be the <code>Month</code> date, and the Y axis should be the <code>Month_score</code> column.</p>
  <p>I thought I understood how this worked, but my plot shows no data:</p>
  <pre><code>library(dplyr)
  library(ggplot2)
  library(lubdridate)
  
  #Sample data
  test &lt;- tibble(Week = seq(as.Date(&quot;2014/09/04&quot;), by = &quot;week&quot;, length.out = 8),
                 Month = ymd(rep('2014-09-01', 4), rep('2014-10-01', 4)),
                 Week_score = c(2, 3, 4, 6, 5, 7, 8, 9),
                 Month_score = c(15, NA, NA, NA, 29, NA, NA, NA))
  
  #My function
  make_time_plot &lt;- function(data, time_period = c(&quot;Week&quot;, &quot;Month&quot;)) {
  
    time_period_score &lt;- paste0(time_period, &quot;_score&quot;)
    
    data %&gt;%
      ggplot(aes(x = {{time_period}}, y = {{time_period_score}})) +
      geom_line()
  }
  
  #Proof that it doesn't work :-(
  make_time_plot(data = test, time_period = &quot;Month&quot;)
  </code></pre>
  <p>Comically Wrong Output:</p>
  <p><a href="https://i.stack.imgur.com/qTQPX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qTQPX.png" alt="enter image description here" /></a></p>