| conserve | R Documentation |
conserve allows its third argument to be bound to the name given as its
second argument in the local environment, while returning the first argument.
A sort of side-effect function which binds to the caller environment.
conserve(obj, name, value)
obj |
[R |
name |
[ |
value |
[R |
The obj itself. The side effect being local binding of value to
the specified name.
The best use of conserve is when one needs to keep an object in a long
sequence of commands to be used later in the same sequence (so mostly pipes).
It is essential to provide this local context (e.g. using local or inside
functions) and avoid altering the global environment, since internally,
rlang::local_bindings is used. The conserve function is what is used with
the "convey" pipe to bind intermediary objects to provided symbols. Exported
for the rare occasion it may be useful on its own. One can also specifically
set conserve(name, value) directives among the convey instructions.
The value argument can be specified in as a magrittr pipe context. That
is, automatic data masking as well as the . symbol representing the
original object.
Other result assemblers:
%$>%(),
%->%(),
%<-%(),
%to%(),
control()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.