Learn R Programming

numform (version 0.6.4)

time_digits: Compute Digits Needed for Quarter Hour Time Vector

Description

This tool computes the minimum number of digits required for a vector of times. The defaults of the tool assumes your time is rounded to within the quarter hour.

Usage

time_digits(x, ...)

Arguments

x

A numeric vector of times rounded tot he nearest quarter hour.

ignored

Value

Returns integer 0-2

Examples

Run this code
# NOT RUN {
time_digits(c(.5, .25, 6))
time_digits(c(.5, 3.5, 6))
time_digits(c(5, 25, 6))

x <- c(.5, .25, 6)
numform::f_pad_left(numform::f_num(x, digits = numform::time_digits(x)))

lapply(
    list(quarter = c(.5, .25, 6), half = c(.5, 3.5, 6), hour = c(5, 25, 6)),
    function(x) {numform::f_pad_left(numform::f_num(x, digits = numform::time_digits(x)))}
)
# }

Run the code above in your browser using DataLab