files {operators} | R Documentation |
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 %<% 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 sink
ing 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
Examples
## Not run:
rnorm(30) %>% "test.txt"
stop("problem") %2>>% "test.txt"
x %<% "test.txt"
x
## End(Not run)