posixct
Adding time to POSIXct object in R
POSIXct objects are a measure of seconds from an origin, usually the UNIX epoch (1st Jan 1970). Just add the requisite number of seconds to the object: x <- Sys.time() x [1] “2012-08-12 13:33:13 BST” x + 3*60*60 # add 3 hours [1] “2012-08-12 16:33:13 BST”
Extracting time from POSIXct
You can use strftime to convert datetimes to any character format: > t <- strftime(times, format=”%H:%M:%S”) > t [1] “02:06:49” “03:37:07” “00:22:45” “00:24:35” “03:09:57” “03:10:41” [7] “05:05:57” “07:39:39” “06:47:56” “07:56:36” But that doesn’t help very much, since you want to plot your data. One workaround is to strip the date element from your times, and … Read more