title: Code Refactoring - Code Improvement suggestions
body: <p><strong>Problem:</strong> I have the following function which I want to write in a dry'er way. Does anyone of you have a suggestion how to improve these functions? Essentially, the function takes a date object and extracts the week, quarter, month and year in additional columns.</p>
  
  <p>Many thanks!!</p>
  
  <pre><code>library(data.table)
  library(tsibble)
  
  determine_entry_date_aggregations &lt;- function(data, date_col = "OBS_DATE"){
    data[, ":="(entry_date_quarter = yearquarter(get(date_col)),
                entry_date_week = format(get(date_col), "%G W%V"),
                entry_date_month = yearmonth(get(date_col)),
                entry_date_year = year(get(date_col)))]
  }
  determine_finish_date_aggregations &lt;- function(data, date_col = "FIN_DATE"){
    data[, ":="(finish_date_quarter = yearquarter(get(date_col)),
                finish_date_week = format(get(date_col), "%G W%V"),
                finish_date_month = yearmonth(get(date_col)),
                finish_date_year = year(get(date_col)))]
  }
  </code></pre>