[R] Lost in POSIX

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Mon Nov 22 10:29:58 CET 2010

Dimitri Shvorob wrote:
>> df$dt <- as.Date(df$t) 
> Thank you, David, but I need a *time* value. "day" was a confusing special
> case; how about "min"? 
Your original question was NOT clear on this point... it was not David's 
fault your question was confusing, and you haven't even hinted at an 
apology for leading him down the wrong path.

Nor would I call this much of an improvement in clarity... what about 
"min"? You want to know the minimum? No? You want to truncate to minute? 
Why then did your original "Try 2" attempt to zero out the minute 
(truncate to hour)?

Perhaps the following will be enough help you figure out an answer to 
whatever your question is. If it doesn't, try asking again with 
consistent variable naming and sample results you want to obtain.

truncMinute <- function(dtm) {
d <- as.POSIXlt(dtm)
d$sec <- 0

df$tt <- truncMinute(df$t)

More information about the R-help mailing list