assn | R Documentation |
Same as assign
with the first two arguments reversed and the default
position referrring to the global environment so it can be used
interactively in a pipeline
assn(value, x, pos = 1, ...)
value |
to be assigned |
x |
name of the object to be assigned |
pos |
where the object is to be assigned. Default is |
... |
other arguments are passed to |
The formula is evaluated using model.frame
and the
result is used as the argument of order
which, in turn is used to
order the data frame. The ordered data frame is returned.
## Not run:
# Using the Prestige data set in package:car and the pipeline
# function in package:magrittr, we can sort the data frame and save the sorted
# version as "Prestige.ordered" with:
require(magrittr)
require(car)
Prestige %>% sortdf(~type+income) %>% assn("Prestige.ordered") %>% dim
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.