title: Covert months represented as integer into dates
body: <p>I am trying to convert months in the following format: </p>
  
  <pre class="lang-r prettyprint-override"><code>histdata &lt;- c("198001", "198002", "198003")
  </code></pre>
  
  <p>I tried:</p>
  
  <pre class="lang-r prettyprint-override"><code>histdata &lt;- transform(histdata, date = as.Date(as.character(date), "%Y%m"))
  </code></pre>
  
  <p>but then all data turned to NA.</p>
  
  <p>I would like to find a solution that will return a vector of dates instead.</p>