in can r I have a numeric vector like c(15, 270, 540, 30, 15, 1440) representing minutes - but how can I create a vector out of this displaying hours and minutes?
Thanks in advance Jasmin
in can r I have a numeric vector like c(15, 270, 540, 30, 15, 1440) representing minutes - but how can I create a vector out of this displaying hours and minutes?
Thanks in advance Jasmin
This uses no packages and gives hours and minutes as asked (as opposed to days, hours and minutes).
x <- c(15, 270, 540, 30, 15, 1440)
sprintf("%02d:%02d", x %/% 60, x %% 60)
## [1] "00:15" "04:30" "09:00" "00:30" "00:15" "24:00"