I have hourly weather data. I\'ve seen the function examples from here: http://casoilresource.lawr.ucdavis.edu/drupal/node/991
I\'m altering the code to account for
Would strptime
work?
df2= structure(c("10:43 AM", "10:54 AM", "11:54 AM", "12:07 PM", "12:15 PM",
"12:54 PM", "1:54 PM", "2:54 PM"), .Dim = c(8L, 1L))
strptime(df2, "%I:%M %p" )
Or in case you don't want the date, something like: Although it depends what kind of class would you want for the object.
substr(strptime(df2, "%I:%M %p" ),11,19)
take a look at ?strptime
.
as.POSIXct(data$TimeEST, format='%I:%M %p')