Type: | Package |
Title: | Find Code Snippets, R Scripts, R Markdown, PDF and Text Files with Pattern Matching |
Version: | 0.2.1 |
Description: | Scans all directories and subdirectories of a path for code snippets, R scripts, R Markdown, PDF or text files containing a specific pattern. Files found can be copied to a new folder. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 6.0.1 |
Imports: | pdftools, stringr |
BugReports: | https://github.com/zumbov2/findR/issues |
NeedsCompilation: | no |
Packaged: | 2018-03-13 10:26:06 UTC; David Zumbach |
Author: | David Zumbach [aut, cre] |
Maintainer: | David Zumbach <david.zumbach@gfzb.ch> |
Repository: | CRAN |
Date/Publication: | 2018-03-13 10:48:45 UTC |
Find PDF files by content with pattern matching
Description
findPDF
scans all directories and subdirectories of a given path for PDF files (.pdf) containing
a specific pattern. Hits can be copied to a new folder.
Usage
findPDF(path = ".", pattern = "Hello World", case.sensitive = TRUE,
show.results = TRUE, copy = FALSE, folder = "findPDF",
overwrite = TRUE)
Arguments
path |
a character vector, path to be scanned. The default corresponds to the working directory, getwd(). |
pattern |
a pattern (regular expression) to search for. |
case.sensitive |
a logical value. If |
show.results |
a logical value. If |
copy |
a logical value. If |
folder |
a character vector, path or name of new folder to copy matching PDF files to. |
overwrite |
a logical value. If |
Examples
# Find all PDF files in the package folder that contain the name Hanna
findPDF(path = system.file(package = "findR"), pattern = "Hanna")
# Save results in a data frame and show hits
dt <- findPDF(path = system.file(package = "findR"), pattern = "Hanna", show.results = TRUE)
dt
Find R Markdown files by content with pattern matching
Description
findRmd
scans all directories and subdirectories of a given path for R Markdown files (.Rmd) containing
a specific pattern. Hits can be copied to a new folder.
Usage
findRmd(path = ".", pattern = "Hello World", case.sensitive = TRUE,
show.results = TRUE, copy = FALSE, folder = "findRmd",
overwrite = TRUE)
Arguments
path |
a character vector, path to be scanned. The default corresponds to the working directory, getwd(). |
pattern |
a pattern (regular expression) to search for. |
case.sensitive |
a logical value. If |
show.results |
a logical value. If |
copy |
a logical value. If |
folder |
a character vector, path or name of new folder to copy matching R Markdown files to. |
overwrite |
a logical value. If |
Examples
# Find all R Markdown files in the package folder that contain a ggplot bar chart
findRmd(path = system.file(package = "findR"), pattern = "geom_bar")
# Save results in a data frame and show hits
dt <- findRmd(path = system.file(package = "findR"), pattern = "geom_bar", show.results = TRUE)
dt
Find R scripts by content with pattern matching
Description
findRscript
scans all directories and subdirectories of a given path for R scripts (.R) containing
a specific pattern. Hits can be copied to a new folder.
Usage
findRscript(pattern = "Hello World", path = ".", case.sensitive = TRUE,
comments = TRUE, show.results = TRUE, copy = FALSE,
folder = "findRscript", overwrite = TRUE)
Arguments
pattern |
a pattern (regular expression) to search for. |
path |
a character vector, path to be scanned. The default corresponds to the working directory, getwd(). |
case.sensitive |
a logical value. If |
comments |
a logical value. If |
show.results |
a logical value. If |
copy |
a logical value. If |
folder |
a character vector, path or name of new folder to copy matching R scripts to. |
overwrite |
a logical value. If |
Examples
# Find all Rscripts in the package folder that use the circlize package
findRscript(path = system.file(package = "findR"), pattern = "circlize")
# Save results in a data frame and show hits
dt <- findRscript(path = system.file(package = "findR"), pattern = "circlize", show.results = TRUE)
dt
Find text files by content with pattern matching
Description
findtxt
scans all directories and subdirectories of a given path for text files (.txt) containing
a specific pattern. Hits can be copied to a new folder.
Usage
findtxt(pattern = "Hello World", path = ".", case.sensitive = TRUE,
show.results = TRUE, copy = FALSE, folder = "findtxt",
overwrite = TRUE)
Arguments
pattern |
a pattern (regular expression) to search for. |
path |
a character vector, path to be scanned. The default corresponds to the working directory, getwd(). |
case.sensitive |
a logical value. If |
show.results |
a logical value. If |
copy |
a logical value. If |
folder |
a character vector, path or name of new folder to copy matching text files to. |
overwrite |
a logical value. If |
Examples
# Find all text files in the package folder that contain the name Einstein
findtxt(path = system.file(package = "findR"), pattern = "Einstein")
# Save results in a data frame and show hits
dt <- findtxt(path = system.file(package = "findR"), pattern = "Einstein", show.results = TRUE)
dt
Find reminders on how to use a specific R function
Description
reminder
scans all directories and subdirectories of a given path for files (.R, .Rmd, .txt) containing
a specific R function and prints the corresponding lines of code.
Usage
reminder(func = "library", path = ".", before = 0, after = 0,
stepwise = TRUE)
Arguments
func |
a function to search for. |
path |
a character vector, path to be scanned. The default corresponds to the working directory, getwd(). |
before |
integer. The number of lines to print before the function. |
after |
integer. The number of lines to print after the function. |
stepwise |
a logical value. If |
Examples
# Find reminder on how to use the function chordDiagram
reminder(func = "chordDiagram", path = system.file(package = "findR"), stepwise = FALSE)