Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erictleung/hp
Pipe a function into help()
https://github.com/erictleung/hp
documentation help magrittr pipe r rstats rstudio
Last synced: 17 days ago
JSON representation
Pipe a function into help()
- Host: GitHub
- URL: https://github.com/erictleung/hp
- Owner: erictleung
- License: other
- Created: 2021-08-12T16:16:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-13T19:31:54.000Z (over 3 years ago)
- Last Synced: 2024-06-11T23:04:58.066Z (7 months ago)
- Topics: documentation, help, magrittr, pipe, r, rstats, rstudio
- Language: R
- Homepage: https://erictleung.com/hp
- Size: 225 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# hp
[![R-CMD-check](https://github.com/erictleung/hp/workflows/R-CMD-check/badge.svg)](https://github.com/erictleung/hp/actions)
The goal of hp is to allow you to pipe a function into help using the {magrittr}
pipe, `%>%`.![Demo of the h function using code shown in the examples section](man/figures/hp.gif)
## Installation
The development version from [GitHub](https://github.com/erictleung/hp) with:
```r
# install.packages("devtools")
remotes::install_github("erictleung/hp")
```## Example
This is a basic example which shows you how to solve a common problem:
```{r example, eval=FALSE}
library(hp)
library(dplyr)# Simple single function
t.test %>% h# Simple single function with parentheses
dim() %>% h# Function but specifying package
dplyr::across %>% h# Function but specifying package with parentheses
dplyr::summarise() %>% h
```## Notes
The `h()` function is designed to only work interactively.
Additionally, this package was created because the {magrittr} pipe doesn't play
well with piping in functions into the `help()` function.This was fixed with the new native R pipe operator, `|>`.
```r
dim |> help()
```Note, the left side should not have parentheses or R will warn you that the
`help()` function requires, "a name, length-one character vector or reserved
word."