Description Usage Arguments Value Author(s) See Also Examples
The functions mutate_which
and transmute_which
are
similar to mutate
and transmute
from package dplyr, except that they work only on a subset
of .data
, this subset being defined by the .condition
.
The functions mutate_which_
and transmute_which_
are
standard evaluation versions, similar to mutate_
and
transmute_
.
1 2 3 4 5 6 7 | mutate_which(.data, .condition, ...)
mutate_which_(.data, .condition, ..., .dots)
transmute_which(.data, .condition, ...)
transmute_which_(.data, .condition, ..., .dots)
|
.data |
A tbl or data.frame. |
.condition |
A condition defining the subset on which the mutate
or transmute operation applies.
New variables are initialized to |
... |
Name-value pairs of expressions. Use |
.dots |
Used to work around non-standard evaluation. |
A tbl or a data frame, depending on the class of .data
.
Adapted from G. Grothendieck on StackOverflow, see http://stackoverflow.com/a/34096575.
mutate
,
mutate_
,
transmute
,
transmute_
from package dplyr.
1 2 3 4 5 6 7 8 9 | df <- mtcars[1:10,]
# Non-standard evaluation
mutate_which(df, gear==4, carb = 100)
transmute_which(df, gear==4, carb = 100)
# Standard evaluation
mutate_which_(df, ~ gear==4, carb = ~ 100)
transmute_which_(df, ~ gear==4, carb = ~ 100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.