files: Read or write an R object to/from a file

Description Usage Arguments Details Value Author(s) See Also Examples

Description

A set of functions to quickly redirect output to a file or read character vectors from a file.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  object %>% file 
  object %>>% file 
  
  object %2>% file 
  object %2>>% file 

  object %*>% file 
  object %*>>% file 
    
  object %<% file 
  object %<<% file 

Arguments

object

R object to print to the file or to read from the file

file

file in which to read or write

Details

%>% sends the object to the file. The object is printed to the file according to the function specified in the operators.print option supplied with this package, most likely to be the print function. See examples.

%>>% appends the output to the file.

%2>% sends the message stream to the file by sinking the message stream to the file. See sink for details. %2>>% appends the message stream to the file.

%*>% sends both output and message streams to the file. %*>>% appends them.

%<% reads the content of the file into the object. %<<% appends the content of the file to the object.

Value

NULL, used for the side effects.

Author(s)

Romain Francois <francoisromain@free.fr>

See Also

file

Examples

1
2
3
4
5
6
7
8
                        
  ## Not run: 
    rnorm(30) %>% "test.txt"
    stop("problem") %2>>% "test.txt"
    x %<% "test.txt"
    x
  
## End(Not run)

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