renkun-ken / pipeR

Multi-Paradigm Pipeline Implementation
Other
169 stars 39 forks source link

Missing expression in Pipe closures should preserve Pipe object #52

Closed renkun-ken closed 10 years ago

renkun-ken commented 10 years ago

If expr is missing in .(expr) or I(expr) in Pipe object in calling, it should be interpreted as doing nothing for conceptual consistent.

A useful case is that if one assign the closure to other symbols, directly calling the function without argument should show the current Pipe contents.

> dot <- Pipe(mtcars)$lm(formula = mpg ~ wt + cyl)$.
> dot()
$value : lm 
------

Call:
lm(formula = mpg ~ wt + cyl, data = .)

Coefficients:
(Intercept)           wt          cyl  
     39.686       -3.191       -1.508  

> dot(coefficients)
$value : numeric 
------
(Intercept)          wt         cyl 
  39.686261   -3.190972   -1.507795