title: specifying as.Date format returns NA in R
body: <p>I have the following DF:</p>
  
  <pre><code>date &lt;- c("2017-10-11","2018-04-02","2017-05-03")
  df &lt;- data.frame(date)
  </code></pre>
  
  <p>The following code fails to format it as a date, instead returning NAs:</p>
  
  <pre><code>df$date &lt;- as.Date(df$date,format='%Y/%m/%d')
  </code></pre>
  
  <p>The following code successfully formats it as a date:</p>
  
  <pre><code>df$date &lt;- as.Date(df$date)
  </code></pre>
  
  <p>I've specified the as.Date format (as in the first as.Date code) in other projects and it has worked for me before. There are numerous responses to similar questions about as.Date returning NAs, but I can't find any that explain why my first as.Date code doesn't work in this situation, but my second one does. I don't need to specify the format for my purposes, but I would like to understand why the first line of code does not work.</p>