Releases: renkun-ken/pipeR
v0.6
New features
- Add
pipeline
function to support expression-based pipeline evaluation. (#60) - Piping to string now
cat
the string in the console. (#61) - Question mark now supports binary operation
("message" ? expression)
in which
expression
is evaluated while"message"
is printed ahead of its value. (#62)
Improvements
<<-
and->>
now correctly perform global assignment in enclosed expression in
a pipeline. (#65)
v0.5
Completely removed deprecated operators, functions, and usage
- Operators (
%:>%
and%|>%
) - Closure
fun()
in Pipe object - No longer supports
->
to build lambda expression
The following notation is NO LONGER supported
data %>>% (df -> lm(mpg ~ cyl + wt, data = df))
Please use formula instead
data %>>% (df ~ lm(mpg ~ cyl + wt, data = df))
Support more flexible assignment
- Support assignment in using
~
,<-
and->
within()
# assign to symbol
foo %>>% (~ bar)
# bar <- foo
# assign and continue piping
foo %>>% (bar <- lm(y ~ x, data = .))
foo %>>% (lm(y ~ x, data = .) -> bar)
# bar <- lm(y ~ x, data = foo)
# assign only for side effect
foo %>>% (~ bar <- lm(y ~ x, data = .))
foo %>>% (~ lm(y ~ x, data = .) -> bar)
# bar <- lm(y ~ x, data = foo); foo
v0.4
What's new in 0.4?
- Major API Change:
%>>%
operator now handles all pipeline mechanisms and other operators are deprecated. - Add
Pipe
object that supports object-based pipeline operation.
Usage
%>>%
The form of the object following %>>%
determines which piping mechanism is used. If the operator is followed by, for example,
Usage | As if |
---|---|
x %>>% f |
f(x) |
x %>>% f(...) |
f(x,...) |
x %>>% { f(.) } |
f(x) |
x %>>% ( f(.) ) |
f(x) |
x %>>% (i -> f(i)) |
f(x) |
x %>>% (i ~ f(i)) |
f(x) |
Pipe()
Pipe()
creates a Pipe object that supports light-weight chaining using internal operators. For example,
Usage | Description |
---|---|
Pipe(x)$foo()$bar() |
Build Pipe object for chaining |
Pipe(x)$foo()$bar() [] |
Extract the final value |
Pipe(x)$fun(expr) |
Pipe to . |
Pipe(x)$fun(x -> expr) |
Pipe to x |
Pipe(x)$fun(x ~ expr) |
Pipe to x |
v0.3
Major operator change
To avoid naming conflict with magrittr
package (issue #12), the first-argument pipe operator is changed to %>>%
and free pipe operator with dot is changed to %:>%
. Now the three operators are:
First-argument piping: %>>%
Free piping: %:>%
Lambda piping: %|>%
Now this package can perfectly coexist with magritter
and dplyr
but is not backward compatible with previous code if old operators are used, please notify the potential issues and upgrade to the new set of operators if possible.
v0.2
- Add lambda piping
%|>%
mtcars %|>%
(df -> lm(mpg ~ ., data=df))
%>>%
no longer allows naked function calling
rnorm(100,10,1) %>>% log %>>% diff
is no longer allowed. You should always use %>%
to call by function name like
rnorm(100,10,1) %>% log %>% diff