danr
January 5, 2018, 11:18pm
6
I don't think there is anything really complete or fully definitive on quosures... that's what you are dealing with here... because is just to new and in a bit of flux, but:
The first source go to is the part @hadley 's new version of Advanced R that discuses quosures
# Quasiquotation
```{r, include = FALSE}
source("common.R")
```
## Introduction
Now that you understand the tree structure of R code, it's time to return to one of the fundamental ideas that make `expr()` and `ast()` work: quotation. In tidy evaluation, all quoting functions are actually quasiquoting functions because they also support unquoting. Where quotation is the act of capturing an unevaluated expression, __unquotation__ is the ability to selectively evaluate parts of an otherwise quoted expression. Together, this is called quasiquotation. Quasiquotation makes it easy to create functions that combine code written by the function's author with code written by the function's user. This helps to solve a wide variety of challenging problems.
Quasiquotation is one of the three pillars of tidy evaluation. You'll learn about the other two (quosures and the data mask) in Chapter \@ref(evaluation). When used alone, quasiquotation is most useful for programming, particularly for generating code. But when it's combined with the other techniques, tidy evaluation becomes a powerful tool for data analysis.
### Outline {-}
* Section \@ref(quasi-motivation) motivates the development of quasiquotation
with a function, `cement()`, that works like `paste()` but automatically
quotes its arguments so that you don't have to.
* Section \@ref(quoting) gives you the tools to quote expressions, whether
they come from you or the user, or whether you use rlang or base R tools.
This file has been truncated. show original
I've also written a tutorial too
This covers some of how they they work but is by no means complete.
1 Like