Title: | Find Code Snippets, R Scripts, R Markdown, PDF and Text Files with Pattern Matching |
---|---|
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. |
Authors: | David Zumbach [aut, cre] |
Maintainer: | David Zumbach <[email protected]> |
License: | GPL-3 |
Version: | 0.2.1 |
Built: | 2024-11-23 02:45:33 UTC |
Source: | https://github.com/zumbov2/findr |
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.
findPDF(path = ".", pattern = "Hello World", case.sensitive = TRUE, show.results = TRUE, copy = FALSE, folder = "findPDF", overwrite = TRUE)
findPDF(path = ".", pattern = "Hello World", case.sensitive = TRUE, show.results = TRUE, copy = FALSE, folder = "findPDF", overwrite = TRUE)
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 |
# 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 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
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.
findRmd(path = ".", pattern = "Hello World", case.sensitive = TRUE, show.results = TRUE, copy = FALSE, folder = "findRmd", overwrite = TRUE)
findRmd(path = ".", pattern = "Hello World", case.sensitive = TRUE, show.results = TRUE, copy = FALSE, folder = "findRmd", overwrite = TRUE)
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 |
# 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 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
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.
findRscript(pattern = "Hello World", path = ".", case.sensitive = TRUE, comments = TRUE, show.results = TRUE, copy = FALSE, folder = "findRscript", overwrite = TRUE)
findRscript(pattern = "Hello World", path = ".", case.sensitive = TRUE, comments = TRUE, show.results = TRUE, copy = FALSE, folder = "findRscript", overwrite = TRUE)
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 |
# 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 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
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.
findtxt(pattern = "Hello World", path = ".", case.sensitive = TRUE, show.results = TRUE, copy = FALSE, folder = "findtxt", overwrite = TRUE)
findtxt(pattern = "Hello World", path = ".", case.sensitive = TRUE, show.results = TRUE, copy = FALSE, folder = "findtxt", overwrite = TRUE)
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 |
# 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 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
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.
reminder(func = "library", path = ".", before = 0, after = 0, stepwise = TRUE)
reminder(func = "library", path = ".", before = 0, after = 0, stepwise = TRUE)
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 |
# Find reminder on how to use the function chordDiagram reminder(func = "chordDiagram", path = system.file(package = "findR"), stepwise = FALSE)
# Find reminder on how to use the function chordDiagram reminder(func = "chordDiagram", path = system.file(package = "findR"), stepwise = FALSE)