Portfolio

library("plyr")
library("dplyr")
library("magrittr")
library("DT")
library("stringr")

cbind(
  Name = list.files("portfolio/", "*.Rmd"),
  ldply(list.files("portfolio/", "*.Rmd", full.names = TRUE), file.info)
) %>%
  dplyr::filter(! Name %in% c("index.Rmd")) %>%
  dplyr::arrange(desc(mtime)) %>%
  dplyr::transmute(
    `Last Modified` = paste0("<a href='http://github.com/aaboyles/Essays/commits/gh-pages/portfolio/", Name, "'>", substr(mtime, 0, 10), "</a>"),
    Name = paste0("<a href='portfolio/", str_sub(Name, 1, -5), ".html'>",
    Name %>%
      str_replace_all("([a-z])([A-Z])", "\\1 \\2") %>%
      str_replace_all("([A-Z]+)([A-Z])", "\\1 \\2") %>%
      str_replace_all("([a-z]+)([0-9]+)", "\\1 \\2") %>%
      str_sub(1, -5), "</a>"),
    `Estimated Length (words)` = floor(size/7)
    ) %>%
  dplyr::select(Name, `Estimated Length (words)`, `Last Modified`) %>%
  datatable(escape = FALSE)