Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/parmsam/forgot
R package to search for that one function you need in that one package
https://github.com/parmsam/forgot
documentation functions package r search
Last synced: 3 months ago
JSON representation
R package to search for that one function you need in that one package
- Host: GitHub
- URL: https://github.com/parmsam/forgot
- Owner: parmsam
- License: other
- Created: 2023-03-29T19:54:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-23T23:40:32.000Z (over 1 year ago)
- Last Synced: 2024-06-04T23:04:19.254Z (5 months ago)
- Topics: documentation, functions, package, r, search
- Language: R
- Homepage: https://parmsam.github.io/forgot/
- Size: 1.83 MB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - parmsam/forgot - R package to search for that one function you need in that one package (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# forgot
The goal of forgot is to help you search for that one function you need in that one package. This package is based on functions from [Rd2roxygen](https://github.com/yihui/Rd2roxygen). The `forgot()` function returns a tibble of section content in R documentation files from a specified package (that's already installed). You can search on this tibble and return an interactive HTML table if needed. There's also a RStudio Addin included that you can use to search package documentation in a small Shiny app. `forgot2()` is for more casual use and will return a simple version of the forgot tibble with just the first two columns by default.
This package provides an alternative to function search without using the help system (`?help()`) in the RStudio IDE. You should still use that though for learning purposes.
## Installation
You can install the development version of forgot like so:
``` r
# install.packages("devtools")
devtools::install_github("parmsam/forgot")
```## Examples
This are examples which show you how to solve common problems:
Create a forgot tibble that has columns for doc sections in package functions
```{r example, eval = T, message = F}
library(forgot)
library(dplyr)
## basic example code
functions_in_pkg <- forgot("stringr")
functions_in_pkg %>%
select(function_name, title, desc) %>%
head()
```Search for a keyword of interest in the forgot tibble
```{r}
forgot("stringr", keyword = "count")
```Or search for a keyword of interest only on specific fields
```{r}
forgot("stringr", keyword = "count", selected = c("title", "desc"))
```If you want to search across multiple packages, here's an example of how you can use purrr to help with that
```{r eval = FALSE}
library(purrr)
c("stringr", "dplyr") %>%
purrr::set_names() %>%
map(forgot, keyword = "count") %>%
list_rbind(names_to = "Package")
```Lastly, here's how you can get a reactable HTML table that you can search on
```{r eval= F}
forgot("stringr", keyword = "count", selected = c("title", "desc"),
interactive = T)
```### Cat a roxygen2 field of interest into your R console
Here's how you can cat (?`cat()` for more info) the parameter field, usage field, or example field. Try it out to see how it looks.
```{r eval = F}
forgot_params("dplyr", "count")
forgot_usage("dplyr", "count")
forgot_exmpls("dplyr", "count")
```
The write logical (see `forgot_exmpls()` documentation for example) argument will create a new RStudio document with the roxygen2 field content of interest that was cat.## Credits
- Hex icon created using the [hexmake
app](https://connect.thinkr.fr/hexmake/) from
[ColinFay](https://github.com/ColinFay/hexmake).
- Confusion icons created by Freepik - Flaticon