Package 'hp'

Title: Pipe a function into help()
Description: After using autocomplete on a function, instead of scrolling to the front of the function to use the question mark to access the help page, this package allows you to pipe the function into a wrapper help function for easier access.
Authors: Eric Leung [aut, cre]
Maintainer: Eric Leung <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2024-08-28 04:18:58 UTC
Source: https://github.com/erictleung/hp

Help Index


Recursively constructs Abstract Syntax Tree for a given expression

Description

Recursively constructs Abstract Syntax Tree for a given expression

Usage

getAST(ee)

Arguments

ee

expression

Value

list

Source

https://stackoverflow.com/a/52080518/6873133

Examples

getAST(quote(a %>% b))

Pipe-able wrapper function around help()

Description

This function allows you to pipe forward functions to open its help page.

Usage

h(x)

Arguments

x

expression

Details

Using the pipe operator is commonplace and can influence the way you think about using functions. When looking up help pages, it is typical to add a question mark ⁠?⁠ to the beginning of a function open its help page (e.g., ?dim). This function allows you to write left-to-right and simply pipe the function of interest into h to open its help page.

Value

None

Source

https://stackoverflow.com/a/52080518/6873133

Examples

# Simple single function
eval %>% h

# Simple single function with parentheses
dim() %>% h

# Function but specifying package
dplyr::across %>% h

# Function but specifying package with parentheses
dplyr::summarise() %>% h

# Fails
iris %>% dplyr::mutate %>% h
iris %>% dplyr::mutate() %>% h