Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
renkun-ken committed Aug 5, 2014
1 parent 4ac624f commit 6c020ea
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
22 changes: 15 additions & 7 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,26 @@ devtools::install_github("pipeR","renkun-ken")

The form of the object following `%>>%` determines which piping mechanism is used. If the operator is followed by, for example,

- `foo` or `foo(...)`: Pipe to its first argument;
- `{ expr }` or `( expr )`: Pipe to symbol `.`;
- `(x -> expr)` or `(x ~ expr)`: Pipe to symbol `x`.
| 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,

- `Pipe(x)$foo()$bar()`: Pipe along a chain of function calls and get a `Pipe` object for further chaining;
- `Pipe(x)$foo()$bar() []`: Extract the final value of the `Pipe` object;
- `Pipe(x)$fun(expr)`: Pipe to `.`;
- `Pipe(x)$fun(x -> expr)` or `Pipe(x)$fun(x ~ expr)`: Pipe to `x`;
| 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` |

## Examples

Expand Down
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,26 @@ devtools::install_github("pipeR","renkun-ken")

The form of the object following `%>>%` determines which piping mechanism is used. If the operator is followed by, for example,

- `foo` or `foo(...)`: Pipe to its first argument;
- `{ expr }` or `( expr )`: Pipe to symbol `.`;
- `(x -> expr)` or `(x ~ expr)`: Pipe to symbol `x`.
| 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,

- `Pipe(x)$foo()$bar()`: Pipe along a chain of function calls and get a `Pipe` object for further chaining;
- `Pipe(x)$foo()$bar() []`: Extract the final value of the `Pipe` object;
- `Pipe(x)$fun(expr)`: Pipe to `.`;
- `Pipe(x)$fun(x -> expr)` or `Pipe(x)$fun(x ~ expr)`: Pipe to `x`;
| 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` |

## Examples

Expand Down

0 comments on commit 6c020ea

Please sign in to comment.