quo_to_args: Pass quosures into a function as arguments

View source: R/kwargs.R

quo_to_argsR Documentation

Pass quosures into a function as arguments

Description

Generally to be paired with args_and_kwargs, quo_to_args passes in a quosure or list of quosures (i.e. from quos) into the supplied function as arguments to that function.

Usage

quo_to_args(.f, quosures, ..., .quos_first = TRUE)

Arguments

.f

The function the arguments will be passed into

quosures

A quosure or list of quosures

...

Any other arguments to be passed into .f. (Unless the ordering fits perfectly, i.e. almost never, use named arguments)

.quos_first

whether the quosures should be inputted to .f before or after the other arguments. This is just for flexibility in some edge cases and users should try to avoid the need to change use this by naming the other arguments

Details

This function has not been tested much with the inclusion of the non-quosure ... arguments. It gets a little fly-by-night beyond simple passing of quosures.

Examples

px <- "Hello"
p <- function(x) print(x)
quo_to_args(p, quo(px))

f <- function(x, y) x/y
quo_to_args(f, quos(3+3, 3))
quo_to_args(f, quos(y=3+3, x=3))

m <- function(x, y, ...) paste0(x," ",y)
quo_to_args(m, quos(y="World", "HAHAHHA", x="Hello"))

burchill/zplyr documentation built on Feb. 2, 2023, 11:01 a.m.