Skip to content

Releases: renkun-ken/pipeR

v0.6

23 Jan 07:54
Compare
Choose a tag to compare

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

30 Sep 17:09
Compare
Choose a tag to compare

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

05 Aug 03:50
Compare
Choose a tag to compare

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

03 Jun 07:30
Compare
Choose a tag to compare

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

21 Apr 10:01
Compare
Choose a tag to compare
  1. Add lambda piping %|>%
mtcars %|>%
  (df -> lm(mpg ~ ., data=df))
  1. %>>% 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

v0.1

16 Apr 11:44
Compare
Choose a tag to compare