title: Add leading Zero to a Date
body: <p>I have dates in a character vector. I cannot easily convert to a date vector using as.Date, because not all of the strings have the form mm/dd/yyyy, thus giving me the ambiguous date error. Some strings have the form m/dd/yyyy (months 1:9).</p>
  
  <p>Here's part of the vector:</p>
  
  <pre><code>data$Date &lt;- c("8/26/2014","3/10/2014","9/25/2014","11/12/2014","8/4/2015")
  </code></pre>
  
  <p>Indicator for date to let me know which strings I need to add a zero to</p>
  
  <pre><code>data$date &lt;- grepl("[0-9]{2}/[0-9]{2}/[0-9]{4}", data$Date)
  </code></pre>
  
  <p>Attempt to add zeros through a conditional:</p>
  
  <pre><code>data$Date&lt;-ifelse(data$date == "FALSE", paste0("0", data$Date), data$Date)
  </code></pre>
  
  <p>Doesn't work (I'm not familiar with paste). Any concise solutions to add a leading zero to single digit months (m/dd/yyy)? I'm guessing gsub or sub? I need all the strings to be in form mm/dd/yyy so I can convert to a date vector.</p>