-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.R
More file actions
29 lines (23 loc) · 751 Bytes
/
Copy pathhelpers.R
File metadata and controls
29 lines (23 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# ========================================
# General settings
# ========================================
# ---
# Set locale
Sys.setlocale("LC_ALL", "C")
# ========================================
# Helper functions
# ========================================
# ---
# Takes a numeric value and return as a formatted time
format_time <- function(value, time_unit = "hours") {
if (time_unit == "hours") {
value_whole <- floor(value)
value_decimal <- floor((value - value_whole) * 100)
value_formatted <-
paste0(value_whole, ":", round(value_decimal * 60 / 100))
} else {
## Other formats not needed yet. Return the same input value
value_formatted <- value
}
value_formatted
}