Description Usage Arguments Details Pronouns Examples

`f_eval_rhs`

evaluates the RHS of a formula and `f_eval_lhs`

evaluates the LHS. `f_eval`

is a shortcut for `f_eval_rhs`

since
that is what you most commonly need.

1 2 3 4 5 6 7 | ```
f_eval_rhs(f, data = NULL)
f_eval_lhs(f, data = NULL)
f_eval(f, data = NULL)
find_data(x)
``` |

`f` |
A formula. Any expressions wrapped in |

`data` |
A list (or data frame). |

`x` |
An object for which you want to find associated data. |

If `data`

is specified, variables will be looked for first in this
object, and if not found in the environment of the formula.

When used with `data`

, `f_eval`

provides two pronouns to make it
possible to be explicit about where you want values to come from:
`.env`

and `.data`

. These are thin wrappers around `.data`

and `.env`

that throw errors if you try to access non-existent values.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
f_eval(~ 1 + 2 + 3)
# formulas automatically capture their enclosing environment
foo <- function(x) {
y <- 10
~ x + y
}
f <- foo(1)
f
f_eval(f)
# If you supply data, f_eval will look their first:
f_eval(~ cyl, mtcars)
# To avoid ambiguity, you can use .env and .data pronouns to be
# explicit:
cyl <- 10
f_eval(~ .data$cyl, mtcars)
f_eval(~ .env$cyl, mtcars)
# Imagine you are computing the mean of a variable:
f_eval(~ mean(cyl), mtcars)
# How can you change the variable that's being computed?
# The easiest way is "unquote" with uq()
# See ?f_interp for more details
var <- ~ cyl
f_eval(~ mean( uq(var) ), mtcars)
``` |

lazyeval documentation built on May 19, 2017, 2:50 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.