pipe: Pipe an R object to a unix command

Description Usage Arguments Value Author(s) See Also Examples

Description

The operator prints the R object into a temporay file and then executes the unix command though a pipe

Usage

1
r %|% u

Arguments

r

Any R object

u

character string representing the unix command

Value

An object of S3-class unixoutput. The print method for unixoutput objects simply cat the string.

Author(s)

Romain Francois <francoisromain@free.fr>

See Also

pipe

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  ## Not run: 
    rnorm(30) %|% 'head -n2'
    rnorm(30) %|% 'sed "s/^ *\\[[0-9]*\\]//g" '
    
    if( require(R4X ) ){
        x <- xml( '<root>
            <child id="1">
              <subchild id = "sub1" >foo</subchild>
              <subchild id = "sub2" >bar</subchild>
            </child>
            <child id="2">
              <subchild id="a">blah</subchild>
              <subchild id="b">bob</subchild>
              <something id="c" />
            </child>
            <fruits>
               <fruit>banana</fruit>
               <fruit>mango</fruit>
            </fruits>
          </root>' )
        x %|% "xml_pp | highlight -S xml -A"  
    }
  
## End(Not run)

operators documentation built on May 2, 2019, 2:47 p.m.