stream-infix: Infix stream operators

Description Usage Arguments Details Value Examples

Description

Infix stream operators

Usage

1
2
3
4
5
6
7
8
9
lhs %<<% rhs

lhs %<<.% rhs

lhs %>>% rhs

lhs %<>% rhs

lhs %<.>% rhs

Arguments

lhs

a pstream object

rhs

a data value or name

Details

The %<<% operator writes the object on the right-hand side to the pstream object on the left-hand side using write_stdin. The %>>% operator reads from the pstream object on the left-hand side and stores the result in the variable on the right-hand side using read_stdout. The %<>% operator writes a string to the stream and immediately reads from standard output and returns the result. This is mostly for quickly viewing the output from a program. The %<<.% and %<.>% operators write to standard input exactly as %<<% and %<>%, but also send end-of-file. This is necessary for some programs to process input.

Value

a pstream object invisibly

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
x = pstream("R", "--vanilla --slave")
x %<<% "R.Version()[[1]]"
x %>>% y
show(y)
x %<<% "R.Version()[[1]]" %<<% "dir()" %>>% y
show(y)
x %<>% "R.Version()[[1]]"
close(x)

x = pstream("tr", c("[:upper:]", "[:lower:]"))
x %<<.% "TEST1" %>>% y
show(y)

thk686/pipestreamr documentation built on May 31, 2019, 10:43 a.m.