Learn R Programming

operators (version 0.1-7)

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

Description

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

Usage

object %>% file 
  object %>>% file 
  
  object %2>% file 
  object %2>>% file 

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

Arguments

Value

NULL, used for the side effects.

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. %<%< code=""> reads the content of the file into the object. %<<%< code=""> appends the content of the file to the object.

See Also

file

Examples

Run this code
rnorm(30) %>% "test.txt"
    stop("problem") %2>>% "test.txt"
    x %<% "test.txt"
    x

Run the code above in your browser using DataLab