title: R date format of column based on criteria of other column
body: <p>Sorry if this is a duplicate, I found many answers where you could change a value in a data frame to a number or string based on another column, however it doesn't seem to work when trying to change each value based on that value. </p>
  
  <p>So  I tried to use some answers for example I read <a href="https://stackoverflow.com/questions/28650957/r-update-a-value-in-one-column-based-on-criteria-in-other-columns">R - Update a Value in One Column Based on Criteria in Other Columns</a></p>
  
  <p>Now look at my data:</p>
  
  <pre><code>class(df[1,1])
  [1] "character"
  
  &gt;df[1,1]  
  
  [1] "2015-03-01T00:00:00Z"
  
  &gt;as.Date(df[1,1])
  
  [1] "2015-03-01"
  </code></pre>
  
  <p>So I know I can transform my data to what I want it to look like. However:</p>
  
  <pre><code>&gt; df$a[df$b=="start"] &lt;- as.Date(df$a[df$b=="start"])
  &gt; df[1,1]
  [1] "16495"
  </code></pre>
  
  <p>I can change them all to a number of string, but when I try and do <code>as.Date</code> on each value it for some reason returns a strange number</p>
  
  <p>I quickly tried:</p>
  
  <pre><code>lapply(df, function(x){if(df$b=="experience.start"){df$a&lt;-as.Date(df$a)}})
  </code></pre>
  
  <p>Although the correct values were being printed to the console I don't know how to use this to edit my data frame. </p>