title: Converting UnixTime to day intervals (morning, evening, night etc.) in R
body: <p>I have a table with a column TIMESTAMP with Unix Time values. I need to convert it to intervals of day, like night, morning, before_afternoon, afternoon, twilight, evening.</p>
  
  <pre><code>data$TIMESTAMP[1]
  [1] 1372636858
  time &lt;- anytime(1372636858)
  &gt; time
  [1] "2013-07-01 01:00:58 WEST" 
  </code></pre>
  
  <p>I am doing:</p>
  
  <pre><code>cut(time, breaks= as.POSIXct(paste("2001-01-01",c("00:00:00", "06:00:00", "09:00:00","12:00:00","15:00:00","18:00:00", "20:00:00")),format="%Y-%m-%d %H:%M:%S", tz ="Portugal"),labels=c('night','morning','before_afternoon','afternoon','twilight','evening'))
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>[1] &lt;NA&gt;
  Levels: night morning before_afternoon afternoon twilight evening
  </code></pre>
  
  <p>What I am doing wrong?</p>