title: subtract days from datetime in r
body: <p>This is kind of a messy way of doing this, but here we go nonetheless. Consider a time series as:</p>
  
  <pre><code>Date1 &lt;- seq(from = as.POSIXct("2010-05-01 02:00"), 
               to = as.POSIXct("2010-10-10 22:00"), by = 3600)
  Dat &lt;- data.frame(DateTime = Date1,
                    x1 = rnorm(length(Date1)))
  </code></pre>
  
  <p>This example data set is for air temperature for a location in new zealand. I would like to compare this data set with a location in the US but when comparing northen and southern hemisphere datasets the seasons are going to be opposite, therefore I'm looking for a reasonable method of altering the seasonal pattern of the NZ data to be the same as the US data. One way I am going to try to do this is by taking the day of year in the data and subtracting 183 and then compare with the US data. My question, therefore, is given a datetime format as shown in the question, how can you subtract 183 days from this and end up with a new date time. So, for this example the first of may is day of year 121, therefore by subtracting 183 days form this, we end up with a day in November 2009. ow can this be done. I realise that the question may not be very clear, but this is the best way to express my intentions. </p>