as.output {iotools} | R Documentation |
Create objects of class output
.
as.output(x, ...)
x |
object to be converted to an instance of |
... |
optional arguments to be passed to implementing methods
of |
as.output
is generic, and methods can be written to support
new classes. The output is meant to be a raw vector suitable for
writing to the disk or sending over a connection.
if con
is set to a connection then the result is NULL
and the method is used for its side-effect, otherwise the result is a
raw vector.
Side note: we cannot create a formal type of output
, because
writeBin
does is.vector()
check which doesn't dispatch
and prevents anything with a class to be written.
Simon Urbanek
m = matrix(sample(letters), ncol=2)
as.output(m)
df = data.frame(a = sample(letters), b = runif(26), c = sample(state.abb,26))
str(as.output(df))
as.output(df, con=iotools.stdout)