%in_block% | R Documentation |
Inline version of let
-block.
a %in_block% b
a |
(left argument) named character vector with target names as names, and replacement names as values. |
b |
(right argument) expression or block to evaluate under let substitution rules. |
evaluated block.
let
d <- data.frame(
Sepal_Length=c(5.8,5.7),
Sepal_Width=c(4.0,4.4),
Species='setosa')
# let-block notation
let(
qc(
AREA_COL = Sepal_area,
LENGTH_COL = Sepal_Length,
WIDTH_COL = Sepal_Width
),
d %.>%
transform(., AREA_COL = LENGTH_COL * WIDTH_COL)
)
# %in_block% notation
qc(
AREA_COL = Sepal_area,
LENGTH_COL = Sepal_Length,
WIDTH_COL = Sepal_Width
) %in_block% {
d %.>%
transform(., AREA_COL = LENGTH_COL * WIDTH_COL)
}
# Note: in packages can make assignment such as:
# AREA_COL <- LENGTH_COL <- WIDTH_COL <- NULL
# prior to code so targets don't look like unbound names.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.