Description Usage Arguments Details Value Note See Also Examples
Transform a date-time vector from class POSIXt
or Date
to a factor.
1 | datetime2fac(p, rng = range(p, na.rm = TRUE))
|
p |
date-time vector |
rng |
range of the factor. |
The range rng
is cut according to different pretty rounded time periods. The cut with the number of levels that is closest to 6 is chosen. Vector p
is cut accordingly. Values of p
outside rng
are translated to NA
.
A factor vector.
This function is still in development stage, and can be improved and optimized. ff
vectors are not implemented yet
1 2 3 4 5 6 7 | d <- as.Date("2012-12-21") + sample.int(500, 1000, replace=TRUE)
d2 <- datetime2fac(d)
levels(d2)
t <- as.POSIXlt(Sys.time(), "GMT") + sample.int(1e5, 1000, replace=TRUE)
t2 <- datetime2fac(t)
levels(t2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.