[R] Read in data table, change columns from factors [RESOLVED]

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Thu Jul 19 23:13:33 CEST 2018

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"


   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,


More information about the R-help mailing list