Browse Source

zap gremlins

master
boB Rudis 5 years ago
parent
commit
c4e4cb29d9
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 2
      DESCRIPTION
  2. 1
      NAMESPACE
  3. 23
      R/zap-gremlins.R
  4. 7
      inst/rstudio/addins.dcf
  5. 11
      man/zapGremlins.Rd

2
DESCRIPTION

@ -30,4 +30,4 @@ Imports:
dplyr,
tidyr,
uuid
RoxygenNote: 6.0.1.9000
RoxygenNote: 6.1.1

1
NAMESPACE

@ -7,6 +7,7 @@ export(join_rows)
export(rantAddin)
export(refresh_renviron)
export(tweet_share)
export(zapGremlins)
import(knitr)
import(magick)
import(miniUI)

23
R/zap-gremlins.R

@ -0,0 +1,23 @@
#' 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)
}

7
inst/rstudio/addins.dcf

@ -31,4 +31,9 @@ Interactive: false
Name: CleanAndGo
Description: Cleanse the environment and execute the script
Binding: cleanAndGo
Interactive: false
Interactive: false
Name: Zap Gremlins
Description: Find R source files with non-ASCII characters
Binding: zapGremlins
Interactive: false

11
man/zapGremlins.Rd

@ -0,0 +1,11 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/zap-gremlins.R
\name{zapGremlins}
\alias{zapGremlins}
\title{Find R source files with non-ASCII characters}
\usage{
zapGremlins()
}
\description{
Find R source files with non-ASCII characters
}
Loading…
Cancel
Save