date_time <- "2018-10-12 16:12:28 PDT" d <- rep(date_time, 3) f1 <- function(d) { lubridate::ymd_hms(d) } str(f1(d)) f2 <- wrapr::VectorizeM(f1, SIMPLIFY = FALSE, UNLIST = TRUE) str(f2(d)) # generate lots of date strings, but only from a few # dates d <- rep(f1(date_time), 1000000) d <- d + sample.int(100, size = length(d), replace = TRUE) d <- as.character(d) timings <- microbenchmark::microbenchmark(f1(d), f2(d)) print(timings)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.