Chad Reyhan Bhatti
2006-Apr-13 20:11 UTC
[R] printing output to a file from the command line
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
Marc Schwartz (via MN)
2006-Apr-13 20:29 UTC
[R] printing output to a file from the command line
On Thu, 2006-04-13 at 15:11 -0500, Chad Reyhan Bhatti wrote:> 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. BhattiSee ?sink and ?capture.output HTH, Marc Schwartz