assn: Assign in a pipeline

Description Usage Arguments Value Author(s) Examples

View source: R/pipeline.R

Description

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

Usage

1
assn( value, name, pos = 1)

Arguments

value

to be assigned

x

name of the object to be assigned

pos

where the object is to be assigned. Default is pos=0 which saves in the global environment

...

other arguments are passed to assign

Value

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.

For example, using the Prestige data set in package:car and the pipeline function in package:magrittr, we can sort the data frame and same the sorted version as "Prestige.ordered" with:

> require(car) > require(magrittr) > Prestige

Author(s)

G. Monette

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## Not run: 
require(magrittr)
require(car)
Prestige  

## End(Not run)

gmonette/spida documentation built on May 14, 2017, 1 p.m.