title: Get a histogram using a date vector
body: <p>I'm working on <a href="https://www.kaggle.com/nguyenhoc/plane-crash" rel="nofollow noreferrer">this</a> data set using R and I'm trying to show the number of incidents each year.</p>
  
  <p>Using R's help pages, I wrote:</p>
  
  <pre><code>getData=read.csv('planecrashinfo_20181121001952.csv')
  attach(getData)
  lct &lt;- Sys.getlocale("LC_TIME"); Sys.setlocale("LC_TIME", "C")
  getData$date&lt;-as.Date(date, format='%B %d, %Y')
  </code></pre>
  
  <p>That works, but using </p>
  
  <pre><code>hist(date, "years", format= '%Y')
  </code></pre>
  
  <p>results in </p>
  
  <blockquote>
    <p>"Error in hist.default(date, "years", format = "%Y") : 'x' deve essere numeric".</p>
  </blockquote>
  
  <p>Is there a package I am not using?</p>