Last active
May 29, 2020 06:04
-
-
Save GuyliannEngels/c515b3ed28209e16b474dde94fd6f62f to your computer and use it in GitHub Desktop.
Check if all .Rmd file are executable in an RStudio project
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
| 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