title: Converting R time column to specific strings
body: <p>I have a column representing time in a data frame in R. </p>
  
  <p>when I call the str() function on the column it says something like this</p>
  
  <pre><code>&gt;str(df2$Time)
   Factor w/ 1441 levels "","00:01","00:02","00:03",..: 1086 1096 1111 and so on
  </code></pre>
  
  <p>The thing is I want to conver this column into string type such that if the time is less than 12:00, it should get modified to the string "moring" , if time is between 12:00 and 6:00 , it is "daylight" and so on. </p>
  
  <p>The first step I thought was to convert this vector to time type of column of data frame, so I used chron  function. </p>
  
  <p>I typed the following command, </p>
  
  <pre><code>&gt;df2$Time&lt;-chron(times=df2$Time,format=c('h:m'))
   Error in convert.times(times., fmt) : format h:m may be incorrect
   In addition: Warning message:
  In is.na(out$s) : is.na() applied to non-(list or vector) of type 'NULL"
  </code></pre>
  
  <p>so I guessed I should have added second parameter in format so I tried the following : </p>
  
  <pre><code>df2$Time&lt;-chron(time=df2$Time,format=c('h:m:s'))
  </code></pre>
  
  <p>But still got the same error</p>
  
  <p>I know this is just the first step, may be my approach too is wrong. Can anyone suggest me how to convert these time data cells to morning, evening , night etc.</p>
  
  <p>Any help is much appreciated. </p>