Dear R-helpers, I am desperately looking for a solution for how to print out the console output to a standard printer. For example, I would like to print out the summary.lm() output, the output of different ftable-functions etc. I use R on a linux machine. The only ways so far have been to copy-paste the output into an external editor or to use sink() to redirect the output into a text file and then use shell commands to print out the file. Both ways work but are a bit laborious :) Many thanks in advance for Your help! Kind regards, Kimmo
?capture.output ?sink> x <- capture.output(runif(20))> x[1] " [1] 0.2730090246 0.4462614490 0.2382041477 0.9826505063 0.1556554718 0.3746872961" [2] " [7] 0.6108254879 0.6617410595 0.6694177436 0.4650380281 0.0414420397 0.2307212995" [3] "[13] 0.5338913775 0.9186298891 0.0006410333 0.8046684864 0.6205502201 0.5352788521" [4] "[19] 0.4255279053 0.7711444888"> cat(x, sep="\n")[1] 0.2730090246 0.4462614490 0.2382041477 0.9826505063 0.1556554718 0.3746872961 [7] 0.6108254879 0.6617410595 0.6694177436 0.4650380281 0.0414420397 0.2307212995 [13] 0.5338913775 0.9186298891 0.0006410333 0.8046684864 0.6205502201 0.5352788521 [19] 0.4255279053 0.7711444888>On Wed, Aug 27, 2008 at 7:44 AM, K. Elo <maillists at nic.fi> wrote:> Dear R-helpers, > > I am desperately looking for a solution for how to print out the console > output to a standard printer. For example, I would like to print out the > summary.lm() output, the output of different ftable-functions etc. I use R > on a linux machine. > > The only ways so far have been to copy-paste the output into an external > editor or to use sink() to redirect the output into a text file and then use > shell commands to print out the file. Both ways work but are a bit laborious > :) > > Many thanks in advance for Your help! > > Kind regards, > Kimmo > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
Hi! Thanks, Jim, for Your quick answer. But my question was how to (re)direct the output to a printer. Kind regards, Kimmo jim holtman wrote:> ?capture.output > ?sink > >> x <- capture.output(runif(20)) > >> x > [1] " [1] 0.2730090246 0.4462614490 0.2382041477 0.9826505063 > 0.1556554718 0.3746872961" > [2] " [7] 0.6108254879 0.6617410595 0.6694177436 0.4650380281 > 0.0414420397 0.2307212995" > [3] "[13] 0.5338913775 0.9186298891 0.0006410333 0.8046684864 > 0.6205502201 0.5352788521" > [4] "[19] 0.4255279053 0.7711444888" >> cat(x, sep="\n") > [1] 0.2730090246 0.4462614490 0.2382041477 0.9826505063 0.1556554718 > 0.3746872961 > [7] 0.6108254879 0.6617410595 0.6694177436 0.4650380281 0.0414420397 > 0.2307212995 > [13] 0.5338913775 0.9186298891 0.0006410333 0.8046684864 0.6205502201 > 0.5352788521 > [19] 0.4255279053 0.7711444888 > > > On Wed, Aug 27, 2008 at 7:44 AM, K. Elo <maillists at nic.fi> wrote: >> Dear R-helpers, >> >> I am desperately looking for a solution for how to print out the console >> output to a standard printer. For example, I would like to print out the >> summary.lm() output, the output of different ftable-functions etc. I use R >> on a linux machine. >> >> The only ways so far have been to copy-paste the output into an external >> editor or to use sink() to redirect the output into a text file and then use >> shell commands to print out the file. Both ways work but are a bit laborious >> :) >> >> Many thanks in advance for Your help! >> >> Kind regards, >> Kimmo >> >> ______________________________________________ >> R-help at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > >