You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
493 B
24 lines
493 B
5 years ago
|
#' Find R source files with non-ASCII characters
|
||
|
#'
|
||
|
#' @export
|
||
|
zapGremlins <- function() {
|
||
|
|
||
|
d <- selectDirectory()
|
||
|
|
||
|
sapply(
|
||
|
list.files(d, pattern = "[.][Rr]$", full.names = TRUE),
|
||
|
function(.x) {
|
||
|
res <- capture.output(tools::showNonASCIIfile(.x), type = "message")
|
||
|
if (length(res)) {
|
||
|
res <- paste0(c(sprintf("# %s -----------\n", .x), res), collapse="\n")
|
||
|
}
|
||
|
}
|
||
|
) -> out
|
||
|
|
||
|
out <- paste0(out, collapse = "\n\n")
|
||
|
|
||
|
rstudioapi::documentNew(out)
|
||
|
|
||
|
}
|
||
|
|