title: replacing a wrong date with the correct date in R
body: <p>I can't seem to find a solution on here, please let me know if there is already one thanks!</p>
  <p>I have a column in r with date and time, some of which are wrong. I am hoping to change the incorrect ones to the correct ones.</p>
  <p>The data is in POSIXct. I have duplicated the original column so I can modify the new one.
  An example of what the data looks like,</p>
  <pre><code>id &lt;- c(1:5)
  opdate &lt;- c(2018-03-01 11:50:00 UTC, 2018-03-02 09:35:00 UTC, 2018-02-27 17:00:00 UTC, 2018-03-06 09:00:00 UTC, 2018-03-08 08:40:00 UTC)
  
  </code></pre>
  <p>I want to change the date for opdate[3] to &quot;2018-03-08 10:05:00 UTC&quot;</p>
  <p>I have tried</p>
  <pre><code>opdate[3] &lt;- &quot;2018-03-08 10:05:00 UTC&quot;
  </code></pre>
  <p>and</p>
  <pre><code>opdate [3] &lt;- &quot;2018-03-08 10:05:00 UTC&quot;, format = &quot;%Y-%m-%d %H:%M:%S&quot;
  </code></pre>
  <p>but it's not working, I think it is probably something basic but I don't know what</p>
  <p>ideally, the output for the ammended opdate would be</p>
  <pre><code>2018-03-01 11:50:00 UTC, 2018-03-02 09:35:00 UTC, 2018-03-08 10:05:00 UTC, 2018-03-06 09:00:00 UTC, 2018-03-08 08:40:00 UTC
  </code></pre>
  <p>but it comes up with error that there is an unexpected numeric constant</p>