Skip to content

Instantly share code, notes, and snippets.

@GuyliannEngels
Last active May 29, 2020 06:04
Show Gist options
  • Select an option

  • Save GuyliannEngels/c515b3ed28209e16b474dde94fd6f62f to your computer and use it in GitHub Desktop.

Select an option

Save GuyliannEngels/c515b3ed28209e16b474dde94fd6f62f to your computer and use it in GitHub Desktop.
Check if all .Rmd file are executable in an RStudio project
knit_rmd <- function(path = ".") {
direction <- fs::dir_ls(path = ".", recursive = TRUE, regexp = "[.][R-r]md$")
t <- purrr::map(direction, purrr::safely(rmarkdown::render))
df <- tibble::tibble(
files = names(t),
result = stringr::str_replace(
string = as.character(purrr::map(t, "result")),
pattern = "NULL", replacement = "ERROR"),
call = as.character(purrr::map(t, c("error", "call"))),
message = as.character(purrr::map(t, c("error", "message")))
)
df
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment