Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(lattice)
- library(data.table)
- library(pipeR)
- N <- 1093L
- DT <- data.table(time = Sys.time() + sample.int(86400L, N),
- value = rnorm(N))
- DT[ , idx := rank(time) %>>% match(sort(unique(.)))]
- lenXTick <- 20L
- xAt <- seq(1, nrow(DT), length.out = lenXTick)
- xTickLabel <- DT[idx %in% pmax(1L, floor(xAt)), .(time)] %>>% format("%Y-%m-%d")
- xyplot(value ~ idx, DT, scales = list(x = list(at = xAt, labels = xTickLabel,
- tick.number = lenXTick, rot = 90)))
Advertisement
Add Comment
Please, Sign In to add comment