[R] printing output to a file from the command line

Chad Reyhan Bhatti bhatticr at stat.rice.edu
Thu Apr 13 22:11:13 CEST 2006


Hello,

I have been looking for a way to print output to a file from the command
line.  I have looked at write(), dump(), dput(), etc and none of these
seem to have the capability I am needing.  Imagine that you have the
output of lm(), glm(), or optim().

out <- lm();
out <- glm();
out <- optim();

I would like to be able to write(out, file="out.txt",replace=TRUE),
write2file(out,file="out.txt",replace=TRUE) or
print(out, file=out.txt",replace=TRUE).  I have several outputs to be
printed so I
would prefer it if I could write them to file from the command line as
opposed to pasting them by hand.

Thanks,

Chad R. Bhatti




More information about the R-help mailing list