is_dateish <- function(x) {
lubridate::is.Date(x) || lubridate::is.POSIXt(x)
}
fmi_format_date <- function(x) {
stopifnot(is_dateish(x))
format(x, format = "%Y-%m-%dT%H:%M:%SZ")
}
delay_by <- function(ms, f) {
force(f)
force(ms)
function(...) {
Sys.sleep(ms / 1000)
f(...)
}
}
prepend_column <- function(.data, ...) {
tibble::add_column(.data, ..., .before = 1L)
}
re_match <- function(x, pattern) {
do.call("rbind", regmatches(x, regexec(pattern, x)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.