# NOT RUN {
f_12_hour(Sys.time())
f_12_hour(Sys.time(), pad.char ='0')
f_12_hour(Sys.time(), pad.char =' ')
f_12_hour(Sys.time(), '%I:%M:%S %p')
f_12_hour(c(NA, 0:24), '%I %p')
set.seed(10)
times <- as.POSIXct(sample(seq_len(1e4), 12), origin = '1970-01-01')
paste(f_12_hour(range(times)), collapse = ' to ')
# }
# NOT RUN {
library(tidyverse)
set.seed(10)
data_frame(
time = as.POSIXct(sample(seq_len(1e4), 12), origin = '1970-01-01'),
val = sample(1:20, length(time), TRUE)
) %>%
mutate(prop = val/sum(val)) %>%
ggplot(aes(time, prop)) +
geom_line() +
scale_x_time(labels = ff_12_hour(format = '%I %p')) +
scale_y_continuous(labels = ff_prop2percent(digits = 0))
# }
Run the code above in your browser using DataLab