This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` r | |
library(xml2) | |
library(dplyr) | |
library(purrr) | |
library(stringr) | |
# From the root node: | |
# If has_children, then recurse. | |
# Otherwise, attributes, value and children (nested) to data frame. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timeHMS_formatter <- function(x) { | |
x[is.na(x)] <- 0 | |
h <- trunc(x * 24) | |
m <- trunc(x * 24 * 60) | |
s <- x * 24 * 60 * 60 %% 60 | |
s <- round(s, 2) | |
lab <- sprintf('%02d:%02d:%02d', h, m, s) # Format the strings as HH:MM:SS | |
lab <- gsub('^00:', '', lab) # Remove leading 00: if present | |
lab <- gsub('^0', '', lab) # Remove leading 0 if present | |
} |
NewerOlder