On Thu, 19 Jul 2018, David Winsemius wrote:
You can use format to only display the time portion of a datetime object.
format( Sys.time(), "%H:%M")
[1] "13:57"
You can append the current date to a "time-only" character value and as.POSIXct
will do that for you:
as.POSIXct("00:00", format="%H:%M")
[1] "2018-07-19 PDT"
as.POSIXct(c("00:00", "00:01"), format="%H:%M")
[1] "2018-07-19 00:00:00 PDT" "2018-07-19 00:01:00 PDT"
David,
I read about these in my R books and on web pages. I kept looking for a
time data type analogous to as.Date, as.character, and as.numeric. That's
what sent me in the wrong direction.
There is a difftime-class in base R And the lubridate package defines a
duration class. It's not a package I use, and I cannot tell off the top of
my head what it thinks the difference might be between a "time-span" and a
"duration".
Good to know for the future.
BTW, in a much earlier response you questioned why there were highly
negative elevations. Good question, because those should have been NAs and I
don't know how I let them in the data I manually extracted from PDF reports
from the USGS.
Best regards,
Rich
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.