Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zumbov2/findr
Find code snipptes, R scripts, R markdown, PDF and text files by content with pattern matching
https://github.com/zumbov2/findr
find markdown package pdf r scripts txt
Last synced: about 1 month ago
JSON representation
Find code snipptes, R scripts, R markdown, PDF and text files by content with pattern matching
- Host: GitHub
- URL: https://github.com/zumbov2/findr
- Owner: zumbov2
- Created: 2018-01-24T23:51:08.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-09T08:11:12.000Z (almost 5 years ago)
- Last Synced: 2024-09-29T00:44:34.374Z (about 2 months ago)
- Topics: find, markdown, package, pdf, r, scripts, txt
- Language: R
- Homepage:
- Size: 1.62 MB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![Lifecycle](https://img.shields.io/badge/lifecycle-retired-orange.svg)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/findR)](https://cran.r-project.org/package=findR)
[![Build Status](https://travis-ci.org/zumbov2/findR.svg?branch=master)](https://travis-ci.org/zumbov2/findR)
[![Licence](https://img.shields.io/badge/licence-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)
[![cranlogs](https://cranlogs.r-pkg.org/badges/grand-total/findR)](http://cran.rstudio.com/web/packages/findR/index.html)
# findR
The `findR` functions `findRscript`, `findRmd`, `findPDF`, and `findtxt` scan all directories and subdirectories of a given path for R scripts, R Markdown, PDF and text files with content that matches a specific pattern. Files found can be copied to a folder. `reminder` prints examples of previously used code directly to the console.## Installation
The version 0.2.1 is on [CRAN](https://cran.r-project.org/web/packages/findR/index.html), and you can install it by:
```r
install.packages("findR")
```
For regularly updated version (latest: 0.2.1) install from GitHub:
```r
install.packages("devtools")
devtools::install_github("zumbov2/findR")
```
## Example `reminder`
`reminder` serves as a memory aid for previously used code. Given a specific path, it searches for code examples of a function. By default, hits are displayed one after the other in the console. With `stepwise = F` it is possible to print all hits at once. You can use the arguments `before` and `after` to print preceding and/or subsequent lines of code.
```r
reminder(func = "chordDiagram",
path = "myProjects")
```
![](https://github.com/zumbov2/findR/blob/master/img/reminder.gif)## Example `findRscript`
Hmm, I've used the [circlize package](https://cran.r-project.org/web/packages/circlize/index.html) before, but I can't remember where or when! I apply `findRscript` to the main directory of my R projects.```r
findRscript(pattern = "circlize",
path = "C:/Users/David Zumbach/Desktop/R",
show.results = F,
copy = T,
folder = "myChordScripts")
```
[12 seconds later](https://www.youtube.com/watch?v=oeUcLaD9pR4):```r
Number of R scripts scanned: 1155
Number of R scripts with matching content: 20
Total number of matches: 40
```
![](https://github.com/zumbov2/findR/blob/master/img/folder.png)## Example `findPDF`
Too many papers to read?![](https://github.com/zumbov2/findR/blob/master/img/f2.png)
`findPDF` helps you focus!
```r
findPDF(pattern = "tensorflow",
path = "2017/machine_learning",
copy = T,
folder = "2017/tensorflow")
```
15 seconds later and you've got your new reading list:![](https://github.com/zumbov2/findR/blob/master/img/f3.png)
## Some gimmickry
What `ggplot2` type am I? Let's find out with `findR`.```r
geom_types <- c("geom_bar", "geom_line", "geom_point", "geom_histogram")
hits <- vector(mode = "numeric", length = 4)for (i in 1:length(geom_types)) {
hits[i] <- nrow(findRscript(pattern = geom_types[i], comments = F))
}
```The tension is getting higher.
```r
library(tidyverse)
ggstats <- data_frame(type = geom_types, freq = hits)ggstats %>%
mutate(type = factor(type, levels = type[order(freq, decreasing = T)])) %>%
ggplot(aes(type, freq)) +
geom_bar(stat = "identity") +
theme_minimal() +
labs(x = "", y = "")
ggsave("type.png", dpi = 500)
```Tadaaa...
![](https://github.com/zumbov2/findR/blob/master/img/type.png)
Punkt. Aus. Ende.